Index: openacs-4/contrib/obsolete-packages/bboard/ChangeLog =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/ChangeLog,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/ChangeLog 28 Aug 2003 09:41:46 -0000 1.3 @@ -0,0 +1,116 @@ +2001-01-03 Anukul Kapoor + + * www/message.tcl, www/message-threaded.tcl: fixed problem where + "deleted" messages are displayed + + * www/doc/index.html, www/doc/requirements.html: slight + documentation improvements + + * bboard.info: changed version to 4.0.2rc + + * sql/bboard-drop.sql: added support for dropping attachments and + email a friend droppings + + * www/forum-view.adp: fixed a buggy link to "All messages" + + * www/message-threaded.adp: added anchor support + + * www/message-list.adp: support for showing the date in search + results + + * www/search.adp, www/search.tcl: we know show the date on search + results + + * www/message-new-3.tcl: add support for user editable permissions + + * www/message-entry.adp: don't show attachments when replying + + * www/message.adp, www/message.tcl, www/messages-by-user.tcl, + www/search.tcl: support for anchored reference to replies + + * www/message-mail-2.tcl: fixed email a friend artifact messages + not to point with reply_to at parent message. also updated to use + new return redirect target + + * www/message-list.adp: support for last updated column + + * www/master.adp: context_bar is no longer required + + * www/forum-view.adp, www/forum.tcl: support for "last updated" + column on forum overview page as well as last_n_days of messages + being shown + + * www/attachment-delete.tcl, www/attachment.tcl, + www/message-attach.tcl, www/simple-message.adp, + www/simple-message.tcl, www/message-attach-2.tcl, + www/message-attach.adp: added attachment support + + * www/forum-by-category.tcl: formatting change + + * tcl/bboard-procs.tcl: added attachment support and a work around + for an acs-messaging bug + + * bboard.info: added parameters for: mailing a friend user posts + editable attachments enabled max attachment size display last N + days + +2000-12-04 Anukul Kapoor + + * bboard.info: updated file and version info + + * sql/upgrade-4.0.1-4.0.2.sql: removed a redundant index creation + +2000-12-01 Anukul Kapoor + + * bboard.info: updated file and version info + + * tcl/bboard-procs.tcl: Added bboard_n_spaces proc + + * www/forum-delete.tcl: + * www/forum-delete.adp: + * www/forum-delete-2.tcl: Added UI for deleting a forum. + + * www/index.tcl: Added querying for bboard_forum_delete permissions + * www/index.adp: Added links to deleting a forum + +2000-12-01 John Prevost + + * www/message-delete-2.tcl: Fixed typo in contract + + * sql/upgrade-4.0.1-4.0.2.sql: + * sql/bboard-create.sql: Added appropriate on delete cascade + clauses. + + * www/category-delete.tcl: + * www/category-delete.adp: + * www/category-delete-2.tcl: Added UI for deleting a category. + + * www/forum-view.adp: Now expects categories rows to have a + delete_p column. Provides a link to delete the category if it's + "t". + + * www/master.adp: Master template for bboard now calls out to the + default master (picking up appropriate colors and style from the + core-ui.) + +2000-11-30 John Prevost + + * www/message-mail.tcl: + * www/message-mail.adp: + * www/message-mail-2.tcl: Preliminary UI for mailing a friend. + + * www/simple-message.tcl: + * www/simple-message.adp: Added "send to a friend" link. + +2000-11-27 Anukul Kapoor + + * Released 4.0.1 + + * sql/upgrade-4.0b-4.0.sql: + * sql/upgrade-4.0-4.0.1.sql: Added bboard_im_convert to the + upgrade script. Incremented version number to be sure it gets + run. + +2000-11-27 Anukul Kapoor + + * Released 4.0 (initial production release) \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/bboard.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/bboard.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/bboard.info 28 Aug 2003 09:41:46 -0000 1.7 @@ -0,0 +1,192 @@ + + + + + Bboard + Bboard Forums + f + f + + + + oracle + postgresql + + Anukul Kapoor + John Prevost + ACS 4 bboard package. + 2001-02-13 + ArsDigita Corporation + This is the release candidate for bboard version 4.0.2. This package provides customizable discussion forums for a community of users. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-create.sql 28 Aug 2003 09:41:46 -0000 1.6 @@ -0,0 +1,427 @@ +-- +-- packages/bboard/sql/bboard-create.sql +-- +-- @author Anukul Kapoor +-- @author John Prevost +-- @creation-date 2000-08-29 +-- @cvs-id $Id: bboard-create.sql,v 1.6 2003/08/28 09:41:46 lars Exp $ +-- + +set feedback off + +-- separate parts so that if one fails, the rest happens + +begin + + -- create the privileges + + acs_privilege.create_privilege('bboard_create_forum'); + acs_privilege.create_privilege('bboard_create_category'); + acs_privilege.create_privilege('bboard_create_message'); + acs_privilege.create_privilege('bboard_write_forum'); + acs_privilege.create_privilege('bboard_write_category'); + acs_privilege.create_privilege('bboard_write_message'); + acs_privilege.create_privilege('bboard_read_forum'); + acs_privilege.create_privilege('bboard_read_category'); + acs_privilege.create_privilege('bboard_read_message'); + acs_privilege.create_privilege('bboard_delete_forum'); + acs_privilege.create_privilege('bboard_delete_category'); + acs_privilege.create_privilege('bboard_delete_message'); + acs_privilege.create_privilege('bboard_moderate_forum'); + +end; +/ +show errors + +begin + + -- bind privileges to global names + + acs_privilege.add_child('create','bboard_create_forum'); + acs_privilege.add_child('create','bboard_create_category'); + acs_privilege.add_child('create','bboard_create_message'); + acs_privilege.add_child('write','bboard_write_forum'); + acs_privilege.add_child('write','bboard_write_category'); + acs_privilege.add_child('write','bboard_write_message'); + acs_privilege.add_child('read','bboard_read_forum'); + acs_privilege.add_child('read','bboard_read_category'); + acs_privilege.add_child('read','bboard_read_message'); + acs_privilege.add_child('delete','bboard_delete_forum'); + acs_privilege.add_child('delete','bboard_delete_category'); + acs_privilege.add_child('delete','bboard_delete_message'); + acs_privilege.add_child('admin','bboard_moderate_forum'); +end; +/ +show errors + + +declare + default_context acs_objects.object_id%TYPE; + registered_users acs_objects.object_id%TYPE; + the_public acs_objects.object_id%TYPE; +begin + + default_context := acs.magic_object_id('default_context'); + registered_users := acs.magic_object_id('registered_users'); + the_public := acs.magic_object_id('the_public'); + + -- give registered users the power to post by default + + acs_permission.grant_permission ( + object_id => default_context, + grantee_id => registered_users, + privilege => 'bboard_create_message' + ); + + -- give the public the power to read by default + + acs_permission.grant_permission ( + object_id => default_context, + grantee_id => the_public, + privilege => 'bboard_read_message' + ); + + acs_permission.grant_permission ( + object_id => default_context, + grantee_id => the_public, + privilege => 'bboard_read_category' + ); + + acs_permission.grant_permission ( + object_id => default_context, + grantee_id => the_public, + privilege => 'bboard_read_forum' + ); + + acs_object_type.create_type ( + supertype => 'acs_message', + object_type => 'bboard_message', + pretty_name => 'BBoard Message', + pretty_plural => 'BBoard Messages', + table_name => 'BBOARD_MESSAGES', + id_column => 'MESSAGE_ID' + ); + + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'bboard_forum', + pretty_name => 'BBoard Forum', + pretty_plural => 'BBoard Forums', + table_name => 'BBOARD_FORUMS', + id_column => 'FORUM_ID', + name_method => 'BBOARD_FORUM.NAME' + ); + + acs_object_type.create_type ( + supertype => 'acs_object', + object_type => 'bboard_category', + pretty_name => 'BBoard Category', + pretty_plural => 'BBoard Categories', + table_name => 'BBOARD_CATEGORIES', + id_column => 'CATEGORY_ID', + name_method => 'BBOARD_CATEGORY.NAME' + ); + +end; +/ +show errors + +-- bboard messages +-- +-- these are subtypes of acs_message +-- all of the metadata is in acs_messages + +create table bboard_messages ( + message_id constraint bboard_messages_msg_id_fk + references acs_messages(message_id) + on delete cascade + constraint bboard_messages_msg_id_pk + primary key +); + +-- bboard forums +-- +-- these act as primary containers for messages +-- a message's context_id will point to its forum + +create table bboard_forums ( + forum_id integer + constraint bboard_forums_forum_id_fk + references acs_objects (object_id) + constraint bboard_forums_pk + primary key, + short_name varchar(400) + constraint bboard_forums_short_name_nn + not null, + charter varchar(4000), + moderated_p char(1) + constraint bboard_forums_moderated_p_nn + not null + constraint bboard_forums_moderated_p_ck + check (moderated_p in ('t','f')), + bboard_id integer + constraint bboard_forums_bboard_id_nn + not null + constraint bboard_forums_bboard_id_fk + references apm_packages (package_id) + on delete cascade +); + +create index bboard_forums_bboard_id_idx + on bboard_forums (bboard_id); + +create table bboard_forum_message_map ( + forum_id integer + constraint bboard_fmm_forum_id_fk + references bboard_forums (forum_id) + on delete cascade, + message_id integer + constraint bboard_fmm_message_id_fk + references bboard_messages (message_id) + on delete cascade, + status varchar(20) + constraint bboard_fmm_status_ck + check (status in ('unmoderated', 'approved', 'rejected')) + constraint bboard_fmm_status_nn + not null, + constraint bboard_forum_message_map_pk + primary key (forum_id, message_id) +); + +create index bboard_fmm_message_id_idx + on bboard_forum_message_map (message_id); + +create index bboard_fmm_status_idx + on bboard_forum_message_map (status); + +-- bboard categories +-- +-- these are for intra-forum categorization +-- categories will be scoped to forums via their acs_object.context_id + +create table bboard_categories ( + category_id integer + constraint bboard_c_category_id_fk + references acs_objects (object_id) + on delete cascade + constraint bboard_c_category_id_pk + primary key, + short_name varchar(400) + constraint bboard_c_short_name_nn + not null, + forum_id integer + constraint bboard_c_forum_id_fk + references bboard_forums (forum_id) + on delete cascade + constraint bboard_c_forum_id_nn + not null, + description varchar(4000) +); + +create index bboard_categories_forum_id_idx + on bboard_categories (forum_id); + +create table bboard_category_message_map ( + category_id integer + constraint bboard_cmm_category_id_fk + references bboard_categories (category_id) + on delete cascade, + message_id integer + constraint bboard_cmm_message_id_fk + references bboard_messages (message_id) + on delete cascade, + constraint bboard_category_message_map_pk + primary key (category_id, message_id) +); + +create index bboard_cmm_message_id_idx + on bboard_category_message_map (message_id); + +@@ bboard-views + +-- Tables to track subscriptions + +create table bboard_forum_subscribers ( + forum_id integer + constraint bboard_fs_forum_id_fk + references bboard_forums (forum_id) + on delete cascade, + subscriber_id integer + constraint bboard_fs_subscriber_id_fk + references parties (party_id) + on delete cascade, + constraint bboard_forum_subscribers_pk + primary key (forum_id, subscriber_id) +); + +create index bboard_fs_subscriber_id_idx + on bboard_forum_subscribers (subscriber_id); + +create table bboard_category_subscribers ( + category_id integer + constraint bboard_cs_category_id_fk + references bboard_categories (category_id) + on delete cascade, + subscriber_id integer + constraint bboard_cs_subscriber_id_fk + references parties (party_id) + on delete cascade, + constraint bboard_category_subscribers_pk + primary key (category_id, subscriber_id) +); + +create index bboard_cs_subscriber_id_idx + on bboard_category_subscribers (subscriber_id); + +create table bboard_thread_subscribers ( + thread_id integer + constraint bboard_ts_thread_id_fk + references bboard_messages (message_id) + on delete cascade, + subscriber_id integer + constraint bboard_ts_subscriber_id_fk + references parties (party_id) + on delete cascade, + constraint bboard_thread_subscribers_pk + primary key (thread_id, subscriber_id) +); + +create index bboard_ts_subscriber_id_idx + on bboard_thread_subscribers (subscriber_id); + +@@ bboard-packages + +set feedback on + +-- This was stolen from ACS 3.x www/doc/sql/site-wide-search.sql +-- to provide functionality until it is refactored into the ACS core + +-- Query to take free text user entered query and frob it into something +-- that will make interMedia happy. Provided by Oracle. + +create or replace function bboard_im_convert( + query in varchar2 default null + ) return varchar2 +is + i number :=0; + len number :=0; + char varchar2(1); + minusString varchar2(256); + plusString varchar2(256); + mainString varchar2(256); + mainAboutString varchar2(500); + finalString varchar2(500); + hasMain number :=0; + hasPlus number :=0; + hasMinus number :=0; + token varchar2(256); + tokenStart number :=1; + tokenFinish number :=0; + inPhrase number :=0; + inPlus number :=0; + inWord number :=0; + inMinus number :=0; + completePhrase number :=0; + completeWord number :=0; + code number :=0; +begin + + len := length(query); + +-- we iterate over the string to find special web operators + for i in 1..len loop + char := substr(query,i,1); + if(char = '"') then + if(inPhrase = 0) then + inPhrase := 1; + tokenStart := i; + else + inPhrase := 0; + completePhrase := 1; + tokenFinish := i-1; + end if; + elsif(char = ' ') then + if(inPhrase = 0) then + completeWord := 1; + tokenFinish := i-1; + end if; + elsif(char = '+') then + inPlus := 1; + tokenStart := i+1; + elsif((char = '-') and (i = tokenStart)) then + inMinus :=1; + tokenStart := i+1; + end if; + + if(completeWord=1) then + token := '{ '||substr(query,tokenStart,tokenFinish-tokenStart+1)||' }'; + if(inPlus=1) then + plusString := plusString||','||token||'*10'; + hasPlus :=1; + elsif(inMinus=1) then + minusString := minusString||'OR '||token||' '; + hasMinus :=1; + else + mainString := mainString||' NEAR '||token; + mainAboutString := mainAboutString||' '||token; + hasMain :=1; + end if; + tokenStart :=i+1; + tokenFinish :=0; + inPlus := 0; + inMinus :=0; + end if; + completePhrase := 0; + completeWord :=0; + end loop; + + -- find the last token + token := '{ '||substr(query,tokenStart,len-tokenStart+1)||' }'; + if(inPlus=1) then + plusString := plusString||','||token||'*10'; + hasPlus :=1; + elsif(inMinus=1) then + minusString := minusString||'OR '||token||' '; + hasMinus :=1; + else + mainString := mainString||' NEAR '||token; + mainAboutString := mainAboutString||' '||token; + hasMain :=1; + end if; + + + mainString := substr(mainString,6,length(mainString)-5); + mainAboutString := replace(mainAboutString,'{',' '); + mainAboutString := replace(mainAboutString,'}',' '); + mainAboutString := replace(mainAboutString,')',' '); + mainAboutString := replace(mainAboutString,'(',' '); + plusString := substr(plusString,2,length(plusString)-1); + minusString := substr(minusString,4,length(minusString)-4); + + -- we find the components present and then process them based on the specific combinations + code := hasMain*4+hasPlus*2+hasMinus; + if(code = 7) then + finalString := '('||plusString||','||mainString||'*2.0,about('||mainAboutString||')*0.5) NOT ('||minusString||')'; + elsif (code = 6) then + finalString := plusString||','||mainString||'*2.0'||',about('||mainAboutString||')*0.5'; + elsif (code = 5) then + finalString := '('||mainString||',about('||mainAboutString||')) NOT ('||minusString||')'; + elsif (code = 4) then + finalString := mainString; + finalString := replace(finalString,'*1,',NULL); + finalString := '('||finalString||')*2.0,about('||mainAboutString||')'; + elsif (code = 3) then + finalString := '('||plusString||') NOT ('||minusString||')'; + elsif (code = 2) then + finalString := plusString; + elsif (code = 1) then + -- not is a binary operator for intermedia text + finalString := 'totallyImpossibleString'||' NOT ('||minusString||')'; + elsif (code = 0) then + finalString := ''; + end if; + + return finalString; +end; +/ +show errors Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-drop.sql 28 Aug 2003 09:41:46 -0000 1.5 @@ -0,0 +1,127 @@ +-- +-- packages/message/sql/bboard-drop.sql +-- +-- @author jmp@arsdigita.com +-- @creation-date 2000-08-31 +-- @cvs-id $Id: bboard-drop.sql,v 1.5 2003/08/28 09:41:46 lars Exp $ +-- + +-- This drop script destroys all messages that belong to forums. +-- It should handle any permission changes that have been done since +-- install by removing any permissions having to do with the standard +-- bboard permissions. + +-- We need to get rid of things that might be referring to +-- bboard objects that would prevent removal. This includes: +-- email-a-friend droppings +-- attachments (files and images) + +-- if something else is pointing at one of our messages, this script +-- will fail and removing bboard will be icky. this is sort of hairy +-- problem with unknown potential intra-package references. + +-- + +-- Delete all messages that belong to forums +declare + cursor message_cursor is + select object_id as message_id + from acs_objects + where object_id in (select object_id + from acs_objects + where object_type = 'acs_message' + start with context_id in (select forum_id + from bboard_forums) + connect by prior object_id = context_id) + order by object_id desc; +begin + for message_val in message_cursor loop + bboard_message.remove(message_val.message_id); + end loop; +end; +/ +show errors + +-- Delete all subscriptions +delete from bboard_thread_subscribers; +delete from bboard_category_subscribers; +delete from bboard_forum_subscribers; + +-- Delete all categories +delete from bboard_category_message_map; +delete from bboard_categories; +delete from acs_objects where object_type = 'bboard_category'; + +-- Delete all forums +delete from bboard_forum_message_map; +delete from bboard_forums; +delete from acs_objects where object_type = 'bboard_forum'; + +-- Delete mime types we created +delete from cr_mime_types where mime_type='text/plain; format=flowed'; + +-- Drop all schema objects +drop package bboard_message; +drop package bboard_category; +drop package bboard_forum; +drop view bboard_messages_by_category; +drop view bboard_messages_all; +drop table bboard_thread_subscribers; +drop table bboard_category_subscribers; +drop table bboard_forum_subscribers; +drop table bboard_category_message_map; +drop table bboard_categories; +drop table bboard_forum_message_map; +drop table bboard_forums; +drop table bboard_messages; + +-- Drop object type metadata +begin + acs_object_type.drop_type ('bboard_forum'); + acs_object_type.drop_type ('bboard_category'); + acs_object_type.drop_type ('bboard_message'); +end; +/ +show errors + +-- Drop permission metadata +delete from acs_permissions + where privilege in + ('bboard_create_forum', 'bboard_create_category', + 'bboard_create_message', 'bboard_write_forum', + 'bboard_write_category', 'bboard_write_message', + 'bboard_read_forum', 'bboard_read_category', + 'bboard_read_message', 'bboard_delete_forum', + 'bboard_delete_category', 'bboard_delete_message', + 'bboard_moderate_forum'); + +delete from acs_privilege_hierarchy + where privilege in + ('bboard_create_forum', 'bboard_create_category', + 'bboard_create_message', 'bboard_write_forum', + 'bboard_write_category', 'bboard_write_message', + 'bboard_read_forum', 'bboard_read_category', + 'bboard_read_message', 'bboard_delete_forum', + 'bboard_delete_category', 'bboard_delete_message', + 'bboard_moderate_forum'); + +delete from acs_privilege_hierarchy + where child_privilege in + ('bboard_create_forum', 'bboard_create_category', + 'bboard_create_message', 'bboard_write_forum', + 'bboard_write_category', 'bboard_write_message', + 'bboard_read_forum', 'bboard_read_category', + 'bboard_read_message', 'bboard_delete_forum', + 'bboard_delete_category', 'bboard_delete_message', + 'bboard_moderate_forum'); + +delete from acs_privileges + where privilege in + ('bboard_create_forum', 'bboard_create_category', + 'bboard_create_message', 'bboard_write_forum', + 'bboard_write_category', 'bboard_write_message', + 'bboard_read_forum', 'bboard_read_category', + 'bboard_read_message', 'bboard_delete_forum', + 'bboard_delete_category', 'bboard_delete_message', + 'bboard_moderate_forum'); + Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-packages.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-packages.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-packages.sql 28 Aug 2003 09:41:46 -0000 1.6 @@ -0,0 +1,702 @@ +-- +-- packages/bboard/sql/bboard-packages.sql +-- +-- @author Anukul Kapoor +-- @author John Prevost +-- @creation-date 2000-11-22 +-- @cvs-id $Id: bboard-packages.sql,v 1.6 2003/08/28 09:41:46 lars Exp $ +-- + +create or replace package bboard_forum +as + + function forum_p ( + forum_id in bboard_forums.forum_id%TYPE + ) return char; + + function new ( + forum_id in bboard_forums.forum_id%TYPE default null, + short_name in bboard_forums.short_name%TYPE, + charter in bboard_forums.charter%TYPE default null, + moderated_p in bboard_forums.moderated_p%TYPE default 'f', + bboard_id in bboard_forums.bboard_id%TYPE, + context_id in acs_objects.context_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'bboard_forum' + ) return acs_objects.object_id%TYPE; + + procedure delete ( + forum_id in bboard_forums.forum_id%TYPE + ); + + procedure set_attrs ( + forum_id in bboard_forums.forum_id%TYPE, + short_name in bboard_forums.short_name%TYPE default null, + charter in bboard_forums.charter%TYPE default null, + moderated_p in bboard_forums.moderated_p%TYPE default null, + bboard_id in acs_objects.context_id%TYPE default null + ); + + procedure subscribe ( + forum_id in bboard_forum_subscribers.forum_id%TYPE, + subscriber_id in bboard_forum_subscribers.subscriber_id%TYPE + ); + + function forum_containing_message ( + message_id in acs_messages.message_id%TYPE + ) return bboard_forums.forum_id%TYPE; + + function name ( + forum_id in acs_objects.object_id%TYPE + ) return varchar2; + +end bboard_forum; +/ +show errors + +create or replace package bboard_category +as + + function category_p ( + category_id in bboard_categories.category_id%TYPE + ) return char; + + function new ( + category_id in bboard_categories.category_id%TYPE default null, + short_name in bboard_categories.short_name%TYPE, + description in bboard_categories.description%TYPE default null, + forum_id in bboard_forums.forum_id%TYPE, + context_id in acs_objects.context_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'bboard_category' + ) return acs_objects.object_id%TYPE; + + procedure delete ( + category_id in bboard_categories.category_id%TYPE + ); + + procedure set_attrs ( + category_id in bboard_categories.category_id%TYPE, + short_name in bboard_categories.short_name%TYPE default null, + description in bboard_categories.description%TYPE default null, + forum_id in integer default null + ); + + procedure subscribe ( + category_id in bboard_category_subscribers.category_id%TYPE, + subscriber_id in bboard_category_subscribers.subscriber_id%TYPE + ); + + function name ( + category_id acs_objects.object_id%TYPE + ) return varchar2; + +end bboard_category; +/ +show errors + +create or replace package bboard_message +as + + function new ( + message_id in acs_messages.message_id%TYPE default null, + reply_to in acs_messages.message_id%TYPE default null, + sent_date in acs_messages.sent_date%TYPE default sysdate, + sender in acs_messages.sender%TYPE default null, + rfc822_id in acs_messages.rfc822_id%TYPE default null, + title in cr_revisions.title%TYPE default null, + mime_type in cr_revisions.mime_type%TYPE default 'text/plain', + text in varchar2 default null, + data in cr_revisions.content%TYPE default null, + context_id in acs_objects.context_id%TYPE default 0, + 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, + object_type in acs_objects.object_type%TYPE default 'bboard_message' + ) return acs_objects.object_id%TYPE; + + function message_p ( + message_id in acs_messages.message_id%TYPE + ) return char; + + procedure set_attrs ( + message_id in acs_messages.message_id%TYPE, + reply_to in acs_messages.reply_to%TYPE default null, + sent_date in acs_messages.sent_date%TYPE default null, + sender in acs_messages.sender%TYPE default null, + title in cr_revisions.title%TYPE default null, + mime_type in cr_revisions.mime_type%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ); + + procedure set_status ( + message_id in bboard_forum_message_map.message_id%TYPE, + forum_id in bboard_forum_message_map.forum_id%TYPE, + status in bboard_forum_message_map.status%TYPE + ); + + procedure add_category ( + message_id in bboard_category_message_map.message_id%TYPE, + category_id in bboard_category_message_map.category_id%TYPE + ); + + procedure remove_category ( + message_id in bboard_category_message_map.message_id%TYPE, + category_id in bboard_category_message_map.category_id%TYPE + ); + + procedure clear_categories ( + message_id in bboard_category_message_map.message_id%TYPE + ); + + procedure subscribe ( + thread_id in bboard_thread_subscribers.thread_id%TYPE, + subscriber_id in bboard_thread_subscribers.subscriber_id%TYPE + ); + + function name ( + message_id acs_objects.object_id%TYPE + ) return varchar2; + + procedure remove_thread ( + thread_id in bboard_messages_all.message_id%TYPE + ); + + procedure remove ( + message_id in bboard_messages_all.message_id%TYPE + ); + +end bboard_message; +/ +show errors + + + + +create or replace package body bboard_forum +as + + function forum_p ( + forum_id in bboard_forums.forum_id%TYPE + ) return char + is + v_check_forum_id integer; + begin + select count(forum_id) into v_check_forum_id + from bboard_forums + where forum_id = forum_p.forum_id; + if v_check_forum_id = 1 then + return 't'; + else + return 'f'; + end if; + end forum_p; + + function new ( + forum_id in bboard_forums.forum_id%TYPE default null, + short_name in bboard_forums.short_name%TYPE, + charter in bboard_forums.charter%TYPE default null, + moderated_p in bboard_forums.moderated_p%TYPE default 'f', + bboard_id in bboard_forums.bboard_id%TYPE, + context_id in acs_objects.context_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'bboard_forum' + ) return acs_objects.object_id%TYPE + is + v_context_id acs_objects.context_id%TYPE; + v_forum_id bboard_forums.forum_id%TYPE; + begin + v_context_id := nvl(context_id, bboard_id); + v_forum_id := acs_object.new ( + context_id => v_context_id, + object_id => forum_id, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + object_type => object_type + ); + insert into bboard_forums + (forum_id, short_name, charter, moderated_p, bboard_id) + values (v_forum_id, short_name, charter, moderated_p, bboard_id); + return v_forum_id; + end new; + + procedure delete ( + forum_id in bboard_forums.forum_id%TYPE + ) + is + begin + delete from bboard_forums + where forum_id = bboard_forum.delete.forum_id; + acs_object.delete(forum_id); + end delete; + + procedure set_attrs ( + forum_id in bboard_forums.forum_id%TYPE, + short_name in bboard_forums.short_name%TYPE default null, + charter in bboard_forums.charter%TYPE default null, + moderated_p in bboard_forums.moderated_p%TYPE default null, + bboard_id in acs_objects.context_id%TYPE default null + ) + is + v_check_forum_id integer; + begin + select count(forum_id) into v_check_forum_id + from bboard_forums + where forum_id = set_attrs.forum_id; + -- It's not a forum. Fail silently? + if v_check_forum_id <> 1 then + return; + end if; + if short_name is not null then + update bboard_forums set short_name = set_attrs.short_name + where forum_id = set_attrs.forum_id; + end if; + update bboard_forums set charter = set_attrs.charter + where forum_id = set_attrs.forum_id; + if moderated_p is not null then + update bboard_forums set moderated_p = set_attrs.moderated_p + where forum_id = set_attrs.forum_id; + end if; + if bboard_id is not null then + update bboard_forums set bboard_id = set_attrs.bboard_id + where forum_id = set_attrs.forum_id; + update acs_objects set context_id = set_attrs.bboard_id + where object_id = set_attrs.forum_id; + end if; + end set_attrs; + + procedure subscribe ( + forum_id in bboard_forum_subscribers.forum_id%TYPE, + subscriber_id in bboard_forum_subscribers.subscriber_id%TYPE + ) + is + begin + insert into bboard_forum_subscribers (forum_id, subscriber_id) + values (forum_id, subscriber_id); + end; + + function forum_containing_message ( + message_id in acs_messages.message_id%TYPE + ) return bboard_forums.forum_id%TYPE + is + v_forum_id bboard_forums.forum_id%TYPE; + begin + select max(forum_id) into v_forum_id + from bboard_forum_message_map + where message_id = forum_containing_message.message_id; + if v_forum_id is null then + return 0; + else + return v_forum_id; + end if; + end forum_containing_message; + + function name ( + forum_id in acs_objects.object_id%TYPE + ) return varchar2 + is + v_forum_name bboard_forums.short_name%TYPE; + begin + select short_name into v_forum_name + from bboard_forums + where forum_id = name.forum_id; + return v_forum_name; + end name; + +end bboard_forum; +/ +show errors + +create or replace package body bboard_category +as + + function category_p ( + category_id in bboard_categories.category_id%TYPE + ) return char + is + v_check_category_id integer; + begin + select count(category_id) into v_check_category_id + from bboard_categories + where category_id = category_p.category_id; + if v_check_category_id = 1 then + return 't'; + else + return 'f'; + end if; + end category_p; + + function new ( + category_id in bboard_categories.category_id%TYPE default null, + short_name in bboard_categories.short_name%TYPE, + description in bboard_categories.description%TYPE default null, + forum_id in bboard_forums.forum_id%TYPE, + context_id in acs_objects.context_id%TYPE default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'bboard_category' + ) return acs_objects.object_id%TYPE + is + v_category_id bboard_categories.category_id%TYPE; + v_context_id acs_objects.context_id%TYPE; + begin + v_context_id := nvl(context_id, forum_id); + v_category_id := acs_object.new ( + object_id => category_id, + context_id => v_context_id, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + object_type => object_type + ); + insert into bboard_categories + (category_id, short_name, description, forum_id) + values (v_category_id, short_name, description, forum_id); + return v_category_id; + end new; + + procedure delete ( + category_id in bboard_categories.category_id%TYPE + ) + is + begin + delete from bboard_categories + where category_id = bboard_category.delete.category_id; + acs_object.delete(category_id); + end delete; + + procedure set_attrs ( + category_id in bboard_categories.category_id%TYPE, + short_name in bboard_categories.short_name%TYPE default null, + description in bboard_categories.description%TYPE default null, + forum_id in integer default null + ) + is + v_check_category_id integer; + begin + select count(category_id) into v_check_category_id + from bboard_categories + where category_id = set_attrs.category_id; + -- It's not a category. Fail silently? + if v_check_category_id <> 1 then + return; + end if; + -- It's a category. Go for it. + if short_name is not null then + update bboard_categories set short_name = set_attrs.short_name + where category_id = set_attrs.category_id; + end if; + if description is not null then + update bboard_categories set description = set_attrs.description + where category_id = set_attrs.category_id; + end if; + if forum_id is not null then + update bboard_categories set forum_id = set_attrs.forum_id + where category_id = set_attrs.category_id; + update acs_objects set context_id = set_attrs.forum_id + where object_id = set_attrs.category_id; + end if; + end set_attrs; + + procedure subscribe ( + category_id in bboard_category_subscribers.category_id%TYPE, + subscriber_id in bboard_category_subscribers.subscriber_id%TYPE + ) + is + begin + insert into bboard_category_subscribers (category_id, subscriber_id) + values (category_id, subscriber_id); + end; + + function name ( + category_id in acs_objects.object_id%TYPE + ) return varchar2 + is + v_category_name bboard_categories.short_name%TYPE; + begin + select short_name into v_category_name + from bboard_categories + where category_id = name.category_id; + return v_category_name; + end name; + +end bboard_category; +/ +show errors + + +create or replace package body bboard_message +as + + function new ( + message_id in acs_messages.message_id%TYPE default null, + reply_to in acs_messages.message_id%TYPE default null, + sent_date in acs_messages.sent_date%TYPE default sysdate, + sender in acs_messages.sender%TYPE default null, + rfc822_id in acs_messages.rfc822_id%TYPE default null, + title in cr_revisions.title%TYPE default null, + mime_type in cr_revisions.mime_type%TYPE default 'text/plain', + text in varchar2 default null, + data in cr_revisions.content%TYPE default null, + context_id in acs_objects.context_id%TYPE default 0, + 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, + object_type in acs_objects.object_type%TYPE default 'bboard_message' + ) return acs_objects.object_id%TYPE + is + v_sent_date acs_messages.sent_date%TYPE; + v_message_id bboard_messages.message_id%TYPE; + begin + v_sent_date := nvl(sent_date, sysdate); + + v_message_id := acs_message.new ( + message_id => message_id, + reply_to => reply_to, + sent_date => v_sent_date, + sender => sender, + title => title, + mime_type => mime_type, + text => text, + data => data, + context_id => context_id, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + object_type => object_type + ); + + insert into bboard_messages + (message_id) + values + (v_message_id); + + return v_message_id; + end new; + + function message_p ( + message_id in acs_messages.message_id%TYPE + ) return char + is + v_check_message_id integer; + begin + select count(message_id) into v_check_message_id + from bboard_messages + where message_id = message_p.message_id; + if v_check_message_id = 1 then + return 't'; + else + return 'f'; + end if; + end message_p; + + procedure set_attrs ( + message_id in acs_messages.message_id%TYPE, + reply_to in acs_messages.reply_to%TYPE default null, + sent_date in acs_messages.sent_date%TYPE default null, + sender in acs_messages.sender%TYPE default null, + title in cr_revisions.title%TYPE default null, + mime_type in cr_revisions.mime_type%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) + is + v_check_message_id integer; + v_revision_id integer; + begin + if message_p(message_id) = 'f' then + return; + end if; + + -- modify the parts that are in acs_messages + + if reply_to is not null then + update acs_messages set reply_to = set_attrs.reply_to + where message_id = set_attrs.message_id; + end if; + if sent_date is not null then + update acs_messages set sent_date = set_attrs.sent_date + where message_id = set_attrs.message_id; + end if; + if sender is not null then + update acs_messages set sender = set_attrs.sender + where message_id = set_attrs.message_id; + end if; + + -- modify the parts that are in cr_revisions + if title is not null or mime_type is not null then + select live_revision into v_revision_id + from cr_items where item_id = set_attrs.message_id + for update; + if title is not null then + update cr_revisions set title = set_attrs.title + where revision_id = v_revision_id; + end if; + if mime_type is not null then + update cr_revisions set mime_type = set_attrs.mime_type + where revision_id = v_revision_id; + end if; + end if; + + -- modify the context_id is acs_objects + + if context_id is not null then + update acs_objects set context_id = set_attrs.context_id + where object_id = set_attrs.message_id; + end if; + + end set_attrs; + + procedure set_status ( + message_id in bboard_forum_message_map.message_id%TYPE, + forum_id in bboard_forum_message_map.forum_id%TYPE, + status in bboard_forum_message_map.status%TYPE + ) + is + begin + if message_p(message_id) = 'f' + or bboard_forum.forum_p(forum_id) = 'f' then + return; + end if; + delete from bboard_forum_message_map + where message_id = set_status.message_id + and forum_id = set_status.forum_id; + if status is not null then + insert into bboard_forum_message_map + (forum_id, message_id, status) + values (set_status.forum_id, set_status.message_id, + set_status.status); + end if; + end set_status; + + procedure add_category ( + message_id in bboard_category_message_map.message_id%TYPE, + category_id in bboard_category_message_map.category_id%TYPE + ) + is + begin + insert into bboard_category_message_map (message_id, category_id) + values (add_category.message_id, add_category.category_id); + end add_category; + + procedure remove_category ( + message_id in bboard_category_message_map.message_id%TYPE, + category_id in bboard_category_message_map.category_id%TYPE + ) + is + begin + delete from bboard_category_message_map + where category_id = remove_category.category_id + and message_id = remove_category.message_id; + end remove_category; + + procedure clear_categories ( + message_id in bboard_category_message_map.message_id%TYPE + ) + is + begin + delete from bboard_category_message_map + where message_id = clear_categories.message_id; + end clear_categories; + + procedure subscribe ( + thread_id in bboard_thread_subscribers.thread_id%TYPE, + subscriber_id in bboard_thread_subscribers.subscriber_id%TYPE + ) + is + begin + insert into bboard_thread_subscribers (thread_id, subscriber_id) + values (thread_id, subscriber_id); + end; + + function name ( + message_id in acs_objects.object_id%TYPE + ) return varchar2 + is + v_message_name bboard_messages_all.title%TYPE; + begin + select title into v_message_name + from bboard_messages_all + where message_id = name.message_id; + return v_message_name; + end name; + + procedure remove_thread ( + thread_id in bboard_messages_all.message_id%TYPE + ) + is + cursor messages_children is + select object_id as child_id, object_type + from acs_objects + where context_id in (select message_id + from acs_messages + connect by prior message_id = reply_to + start with message_id = thread_id); + + cursor messages is + select message_id + from acs_messages + connect by prior message_id = reply_to + start with message_id = thread_id; + + image_p number; + begin + for child_val in messages_children loop + if child_val.object_type = 'bboard_message' then + acs_message.delete(child_val.child_id); + elsif child_val.object_type = 'content_item' then + select count(*) into image_p + from images + where image_id = child_val.child_id; + if image_p = 1 then + acs_message.delete_image(child_val.child_id); + else + acs_message.delete_file(child_val.child_id); + end if; + end if; + end loop; + + for message_val in messages loop + acs_message.delete(message_val.message_id); + end loop; + + end remove_thread; + + procedure remove ( + message_id in bboard_messages_all.message_id%TYPE + ) + is + cursor messages_children is + select object_id as child_id, object_type + from acs_objects + where context_id = message_id; + image_p number; + begin + for child_val in messages_children loop + if child_val.object_type = 'bboard_message' then + acs_message.delete(child_val.child_id); + elsif child_val.object_type = 'content_item' then + select count(*) into image_p + from images + where image_id = child_val.child_id; + if image_p = 1 then + acs_message.delete_image(child_val.child_id); + else + acs_message.delete_file(child_val.child_id); + end if; + end if; + end loop; + + acs_message.delete(message_id); + end remove; + +end bboard_message; +/ +show errors Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-views.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-views.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-views.sql 28 Aug 2003 09:41:46 -0000 1.4 @@ -0,0 +1,34 @@ +-- +-- packages/bboard/sql/bboard-views.sql +-- +-- @author Anukul Kapoor +-- @author John Prevost +-- @creation-date 2001-02-05 +-- @cvs-id $Id: bboard-views.sql,v 1.4 2003/08/28 09:41:46 lars Exp $ +-- + + + +create or replace view bboard_messages_all as + select m.message_id, m.reply_to, m.sent_date, m.sender, + m.title, m.mime_type, m.content, f.forum_id, f.status, + (select count(1) from acs_messages m2 + where m2.message_id in (select mf.message_id + from bboard_forum_message_map mf + where mf.forum_id = f.forum_id) + start with m2.message_id = m.message_id + connect by m2.reply_to = prior m2.message_id) as num_replies, + (select max(sent_date) from acs_messages m2 + where m2.message_id in (select mf.message_id + from bboard_forum_message_map mf + where mf.forum_id = f.forum_id) + start with m2.message_id = m.message_id + connect by m2.reply_to = prior m2.message_id) as last_reply_date + from acs_messages_all m, bboard_forum_message_map f + where m.message_id = f.message_id; + +create or replace view bboard_messages_by_category as + select msg.*, cat.category_id + from bboard_messages_all msg, bboard_category_message_map cat + where msg.message_id = cat.message_id(+); + Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/index_sync.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/index_sync.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/index_sync.sql 28 Aug 2003 09:41:46 -0000 1.3 @@ -0,0 +1,11 @@ +-- Resync the interMedia index every hour. + +DECLARE + v_job number; +BEGIN + dbms_job.submit(v_job, + 'ctx_ddl.sync_index(''cr_rev_content_index'');', + interval => 'sysdate + 1/24'); +END; +/ +show errors \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0-4.0.1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0-4.0.1.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0-4.0.1.sql 28 Aug 2003 09:41:46 -0000 1.3 @@ -0,0 +1,139 @@ +-- +-- packages/bboard/sql/upgrade-4.0-4.0.1.sql +-- +-- @author Anukul Kapoor +-- @creation-date 2000-11-27 +-- @cvs-id $Id: upgrade-4.0-4.0.1.sql,v 1.3 2003/08/28 09:41:46 lars Exp $ +-- + +-- This was stolen from ACS 3.x www/doc/sql/site-wide-search.sql +-- to provide functionality until it is refactored into the ACS core + +-- Query to take free text user entered query and frob it into something +-- that will make interMedia happy. Provided by Oracle. + +create or replace function bboard_im_convert( + query in varchar2 default null + ) return varchar2 +is + i number :=0; + len number :=0; + char varchar2(1); + minusString varchar2(256); + plusString varchar2(256); + mainString varchar2(256); + mainAboutString varchar2(500); + finalString varchar2(500); + hasMain number :=0; + hasPlus number :=0; + hasMinus number :=0; + token varchar2(256); + tokenStart number :=1; + tokenFinish number :=0; + inPhrase number :=0; + inPlus number :=0; + inWord number :=0; + inMinus number :=0; + completePhrase number :=0; + completeWord number :=0; + code number :=0; +begin + + len := length(query); + +-- we iterate over the string to find special web operators + for i in 1..len loop + char := substr(query,i,1); + if(char = '"') then + if(inPhrase = 0) then + inPhrase := 1; + tokenStart := i; + else + inPhrase := 0; + completePhrase := 1; + tokenFinish := i-1; + end if; + elsif(char = ' ') then + if(inPhrase = 0) then + completeWord := 1; + tokenFinish := i-1; + end if; + elsif(char = '+') then + inPlus := 1; + tokenStart := i+1; + elsif((char = '-') and (i = tokenStart)) then + inMinus :=1; + tokenStart := i+1; + end if; + + if(completeWord=1) then + token := '{ '||substr(query,tokenStart,tokenFinish-tokenStart+1)||' }'; + if(inPlus=1) then + plusString := plusString||','||token||'*10'; + hasPlus :=1; + elsif(inMinus=1) then + minusString := minusString||'OR '||token||' '; + hasMinus :=1; + else + mainString := mainString||' NEAR '||token; + mainAboutString := mainAboutString||' '||token; + hasMain :=1; + end if; + tokenStart :=i+1; + tokenFinish :=0; + inPlus := 0; + inMinus :=0; + end if; + completePhrase := 0; + completeWord :=0; + end loop; + + -- find the last token + token := '{ '||substr(query,tokenStart,len-tokenStart+1)||' }'; + if(inPlus=1) then + plusString := plusString||','||token||'*10'; + hasPlus :=1; + elsif(inMinus=1) then + minusString := minusString||'OR '||token||' '; + hasMinus :=1; + else + mainString := mainString||' NEAR '||token; + mainAboutString := mainAboutString||' '||token; + hasMain :=1; + end if; + + + mainString := substr(mainString,6,length(mainString)-5); + mainAboutString := replace(mainAboutString,'{',' '); + mainAboutString := replace(mainAboutString,'}',' '); + mainAboutString := replace(mainAboutString,')',' '); + mainAboutString := replace(mainAboutString,'(',' '); + plusString := substr(plusString,2,length(plusString)-1); + minusString := substr(minusString,4,length(minusString)-4); + + -- we find the components present and then process them based on the specific combinations + code := hasMain*4+hasPlus*2+hasMinus; + if(code = 7) then + finalString := '('||plusString||','||mainString||'*2.0,about('||mainAboutString||')*0.5) NOT ('||minusString||')'; + elsif (code = 6) then + finalString := plusString||','||mainString||'*2.0'||',about('||mainAboutString||')*0.5'; + elsif (code = 5) then + finalString := '('||mainString||',about('||mainAboutString||')) NOT ('||minusString||')'; + elsif (code = 4) then + finalString := mainString; + finalString := replace(finalString,'*1,',NULL); + finalString := '('||finalString||')*2.0,about('||mainAboutString||')'; + elsif (code = 3) then + finalString := '('||plusString||') NOT ('||minusString||')'; + elsif (code = 2) then + finalString := plusString; + elsif (code = 1) then + -- not is a binary operator for intermedia text + finalString := 'totallyImpossibleString'||' NOT ('||minusString||')'; + elsif (code = 0) then + finalString := ''; + end if; + + return finalString; +end; +/ Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.1-4.0.2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.1-4.0.2.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.1-4.0.2.sql 28 Aug 2003 09:41:46 -0000 1.3 @@ -0,0 +1,163 @@ +-- +-- packages/bboard/sql/upgrade-4.0.1-4.0.2.sql +-- +-- @author John Prevost +-- @creation-date 2000-12-01 +-- @cvs-id $Id: upgrade-4.0.1-4.0.2.sql,v 1.3 2003/08/28 09:41:46 lars Exp $ +-- + +set feedback off + +-- arrgh. This isn't entirely safe, but we can't do anything about it! +-- locking the table fails (alter table commands hit the lock, bounce, +-- and the transaction aborts, since DDL isn't transactional.) Can't +-- create another constraint with the same behavior to change behind the +-- back. Lose lose lose. + +alter table bboard_forums + drop constraint bboard_forums_bboard_id_fk; + +alter table bboard_forums add ( + constraint bboard_forums_bboard_id_fk + foreign key (bboard_id) + references apm_packages (package_id) + on delete cascade +); + +create index bboard_forums_bboard_id_idx + on bboard_forums (bboard_id); + +alter table bboard_forum_message_map + drop constraint bboard_fmm_forum_id_fk; +alter table bboard_forum_message_map + drop constraint bboard_fmm_message_id_fk; + +alter table bboard_forum_message_map add ( + constraint bboard_fmm_forum_id_fk + foreign key (forum_id) + references bboard_forums (forum_id) + on delete cascade, + constraint bboard_fmm_message_id_fk + foreign key (message_id) + references acs_messages (message_id) + on delete cascade +); + +alter table bboard_categories + drop constraint bboard_c_forum_id_fk; + +alter table bboard_categories add ( + constraint bboard_c_forum_id_fk + foreign key (forum_id) + references bboard_forums (forum_id) + on delete cascade +); + +create index bboard_categories_forum_id_idx + on bboard_categories (forum_id); + +alter table bboard_forum_subscribers + drop constraint bboard_fs_forum_id_fk; +alter table bboard_forum_subscribers + drop constraint bboard_fs_subscriber_id_fk; + +alter table bboard_forum_subscribers add ( + constraint bboard_fs_forum_id_fk + foreign key (forum_id) + references bboard_forums (forum_id) + on delete cascade, + constraint bboard_fs_subscriber_id_fk + foreign key (subscriber_id) + references parties (party_id) + on delete cascade +); + +create index bboard_fs_subscriber_id_idx + on bboard_forum_subscribers (subscriber_id); + +alter table bboard_category_subscribers + drop constraint bboard_cs_category_id_fk; +alter table bboard_category_subscribers + drop constraint bboard_cs_subscriber_id_fk; + +alter table bboard_category_subscribers add ( + constraint bboard_cs_category_id_fk + foreign key (category_id) + references bboard_categories (category_id) + on delete cascade, + constraint bboard_cs_subscriber_id_fk + foreign key (subscriber_id) + references parties (party_id) + on delete cascade +); + +create index bboard_cs_subscriber_id_idx + on bboard_category_subscribers (subscriber_id); + +alter table bboard_thread_subscribers + drop constraint bboard_ts_thread_id_fk; +alter table bboard_thread_subscribers + drop constraint bboard_ts_subscriber_id_fk; + +alter table bboard_thread_subscribers add ( + constraint bboard_ts_thread_id_fk + foreign key (thread_id) + references acs_messages (message_id) + on delete cascade, + constraint bboard_ts_subscriber_id_fk + foreign key (subscriber_id) + references parties (party_id) + on delete cascade +); + +create index bboard_ts_subscriber_id_idx + on bboard_thread_subscribers (subscriber_id); + + +@@ bboard-views + +-- NOTE: this is only temporary until we figure out how +-- packages will register child types to an acs-message +declare + v_exists integer; +begin + + select decode(count(*),0,0,1) into v_exists + from cr_type_children + where parent_type = 'acs_message_revision' + and child_type = 'content_revision'; + + if v_exists = 0 then + content_type.register_child_type ( + parent_type => 'acs_message_revision', + child_type => 'content_revision' + ); + end if; + + select decode(count(*),0,0,1) into v_exists + from cr_type_children + where parent_type = 'acs_message_revision' + and child_type = 'content_revision'; + + if v_exists = 0 then + content_type.register_child_type ( + parent_type => 'acs_message_revision', + child_type => 'image' + ); + end if; + + select decode(count(*),0,0,1) into v_exists + from cr_type_children + where parent_type = 'acs_message_revision' + and child_type = 'content_revision'; + + if v_exists = 0 then + content_type.register_child_type ( + parent_type => 'acs_message_revision', + child_type => 'content_extlink' + ); + end if; + +end; +/ +show errors Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.2b3-4.0.2b4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.2b3-4.0.2b4.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.2b3-4.0.2b4.sql 28 Aug 2003 09:41:46 -0000 1.3 @@ -0,0 +1,55 @@ +-- +-- packages/bboard/sql/upgrade-4.0.2b3-4.0.2b4.sql +-- +-- @author Anukul Kapoor +-- @creation-date 2001-01-15 +-- @cvs-id $Id: upgrade-4.0.2b3-4.0.2b4.sql,v 1.3 2003/08/28 09:41:46 lars Exp $ +-- + +set feedback off + +-- NOTE: this is only temporary until we figure out how +-- packages will register child types to an acs-message +declare + v_exists integer; +begin + + select decode(count(*),0,0,1) into v_exists + from cr_type_children + where parent_type = 'acs_message_revision' + and child_type = 'content_revision'; + + if v_exists = 0 then + content_type.register_child_type ( + parent_type => 'acs_message_revision', + child_type => 'content_revision' + ); + end if; + + select decode(count(*),0,0,1) into v_exists + from cr_type_children + where parent_type = 'acs_message_revision' + and child_type = 'content_revision'; + + if v_exists = 0 then + content_type.register_child_type ( + parent_type => 'acs_message_revision', + child_type => 'image' + ); + end if; + + select decode(count(*),0,0,1) into v_exists + from cr_type_children + where parent_type = 'acs_message_revision' + and child_type = 'content_revision'; + + if v_exists = 0 then + content_type.register_child_type ( + parent_type => 'acs_message_revision', + child_type => 'content_extlink' + ); + end if; + +end; +/ +show errors Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.2b5-4.0.2b6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.2b5-4.0.2b6.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.2b5-4.0.2b6.sql 28 Aug 2003 09:41:46 -0000 1.3 @@ -0,0 +1,11 @@ +-- +-- packages/bboard/sql/upgrade-4.0.2b5-4.0.2b6.sql +-- +-- @author John Prevost +-- @creation-date 2000-12-01 +-- @cvs-id $Id: upgrade-4.0.2b5-4.0.2b6.sql,v 1.3 2003/08/28 09:41:46 lars Exp $ +-- + +set feedback off + +@@ bboard-views \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.2b6-4.0.2b7.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.2b6-4.0.2b7.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0.2b6-4.0.2b7.sql 28 Aug 2003 09:41:46 -0000 1.3 @@ -0,0 +1,11 @@ +-- +-- packages/bboard/sql/upgrade-4.0.2b6-4.0.2b7.sql +-- +-- @author Anukul Kapoor +-- @creation-date 2001-3-21 +-- @cvs-id $Id: upgrade-4.0.2b6-4.0.2b7.sql,v 1.3 2003/08/28 09:41:46 lars Exp $ +-- + +set feedback off + +@@ bboard-packages \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0b-4.0.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0b-4.0.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/upgrade-4.0b-4.0.sql 28 Aug 2003 09:41:46 -0000 1.3 @@ -0,0 +1,152 @@ +-- +-- packages/bboard/sql/upgrade-4.0b-4.0.sql +-- +-- @author John Prevost +-- @creation-date 2000-11-22 +-- @cvs-id $Id: upgrade-4.0b-4.0.sql,v 1.3 2003/08/28 09:41:46 lars Exp $ +-- + +create table bboard_category_subscribers ( + category_id integer + constraint bboard_cs_category_id_fk + references bboard_categories (category_id), + subscriber_id integer + constraint bboard_cs_subscriber_id_fk + references parties (party_id), + constraint bboard_category_subscribers_pk + primary key (category_id, subscriber_id) +); + +@@ bboard-packages + +-- This was stolen from ACS 3.x www/doc/sql/site-wide-search.sql +-- to provide functionality until it is refactored into the ACS core + +-- Query to take free text user entered query and frob it into something +-- that will make interMedia happy. Provided by Oracle. + +create or replace function bboard_im_convert( + query in varchar2 default null + ) return varchar2 +is + i number :=0; + len number :=0; + char varchar2(1); + minusString varchar2(256); + plusString varchar2(256); + mainString varchar2(256); + mainAboutString varchar2(500); + finalString varchar2(500); + hasMain number :=0; + hasPlus number :=0; + hasMinus number :=0; + token varchar2(256); + tokenStart number :=1; + tokenFinish number :=0; + inPhrase number :=0; + inPlus number :=0; + inWord number :=0; + inMinus number :=0; + completePhrase number :=0; + completeWord number :=0; + code number :=0; +begin + + len := length(query); + +-- we iterate over the string to find special web operators + for i in 1..len loop + char := substr(query,i,1); + if(char = '"') then + if(inPhrase = 0) then + inPhrase := 1; + tokenStart := i; + else + inPhrase := 0; + completePhrase := 1; + tokenFinish := i-1; + end if; + elsif(char = ' ') then + if(inPhrase = 0) then + completeWord := 1; + tokenFinish := i-1; + end if; + elsif(char = '+') then + inPlus := 1; + tokenStart := i+1; + elsif((char = '-') and (i = tokenStart)) then + inMinus :=1; + tokenStart := i+1; + end if; + + if(completeWord=1) then + token := '{ '||substr(query,tokenStart,tokenFinish-tokenStart+1)||' }'; + if(inPlus=1) then + plusString := plusString||','||token||'*10'; + hasPlus :=1; + elsif(inMinus=1) then + minusString := minusString||'OR '||token||' '; + hasMinus :=1; + else + mainString := mainString||' NEAR '||token; + mainAboutString := mainAboutString||' '||token; + hasMain :=1; + end if; + tokenStart :=i+1; + tokenFinish :=0; + inPlus := 0; + inMinus :=0; + end if; + completePhrase := 0; + completeWord :=0; + end loop; + + -- find the last token + token := '{ '||substr(query,tokenStart,len-tokenStart+1)||' }'; + if(inPlus=1) then + plusString := plusString||','||token||'*10'; + hasPlus :=1; + elsif(inMinus=1) then + minusString := minusString||'OR '||token||' '; + hasMinus :=1; + else + mainString := mainString||' NEAR '||token; + mainAboutString := mainAboutString||' '||token; + hasMain :=1; + end if; + + + mainString := substr(mainString,6,length(mainString)-5); + mainAboutString := replace(mainAboutString,'{',' '); + mainAboutString := replace(mainAboutString,'}',' '); + mainAboutString := replace(mainAboutString,')',' '); + mainAboutString := replace(mainAboutString,'(',' '); + plusString := substr(plusString,2,length(plusString)-1); + minusString := substr(minusString,4,length(minusString)-4); + + -- we find the components present and then process them based on the specific combinations + code := hasMain*4+hasPlus*2+hasMinus; + if(code = 7) then + finalString := '('||plusString||','||mainString||'*2.0,about('||mainAboutString||')*0.5) NOT ('||minusString||')'; + elsif (code = 6) then + finalString := plusString||','||mainString||'*2.0'||',about('||mainAboutString||')*0.5'; + elsif (code = 5) then + finalString := '('||mainString||',about('||mainAboutString||')) NOT ('||minusString||')'; + elsif (code = 4) then + finalString := mainString; + finalString := replace(finalString,'*1,',NULL); + finalString := '('||finalString||')*2.0,about('||mainAboutString||')'; + elsif (code = 3) then + finalString := '('||plusString||') NOT ('||minusString||')'; + elsif (code = 2) then + finalString := plusString; + elsif (code = 1) then + -- not is a binary operator for intermedia text + finalString := 'totallyImpossibleString'||' NOT ('||minusString||')'; + elsif (code = 0) then + finalString := ''; + end if; + + return finalString; +end; +/ Index: openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-create.sql 28 Aug 2003 09:41:47 -0000 1.8 @@ -0,0 +1,315 @@ +-- +-- packages/bboard/sql/bboard-create.sql +-- +-- @author Anukul Kapoor +-- @author John Prevost +-- @creation-date 2000-08-29 +-- @cvs-id $Id: bboard-create.sql,v 1.8 2003/08/28 09:41:47 lars Exp $ +-- + +-- separate parts so that if one fails, the rest happens + +-- create the privileges + +begin; + + select acs_privilege__create_privilege('bboard_create_forum',null,null); + select acs_privilege__create_privilege('bboard_create_category',null,null); + select acs_privilege__create_privilege('bboard_create_message',null,null); + select acs_privilege__create_privilege('bboard_write_forum',null,null); + select acs_privilege__create_privilege('bboard_write_category',null,null); + select acs_privilege__create_privilege('bboard_write_message',null,null); + select acs_privilege__create_privilege('bboard_read_forum',null,null); + select acs_privilege__create_privilege('bboard_read_category',null,null); + select acs_privilege__create_privilege('bboard_read_message',null,null); + select acs_privilege__create_privilege('bboard_delete_forum',null,null); + select acs_privilege__create_privilege('bboard_delete_category',null,null); + select acs_privilege__create_privilege('bboard_delete_message',null,null); + select acs_privilege__create_privilege('bboard_moderate_forum',null,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; + + select acs_privilege__add_child('create','bboard_create_forum'); + select acs_privilege__add_child('create','bboard_create_category'); + select acs_privilege__add_child('create','bboard_create_message'); + select acs_privilege__add_child('write','bboard_write_forum'); + select acs_privilege__add_child('write','bboard_write_category'); + select acs_privilege__add_child('write','bboard_write_message'); + select acs_privilege__add_child('read','bboard_read_forum'); + select acs_privilege__add_child('read','bboard_read_category'); + select acs_privilege__add_child('read','bboard_read_message'); + select acs_privilege__add_child('delete','bboard_delete_forum'); + select acs_privilege__add_child('delete','bboard_delete_category'); + select acs_privilege__add_child('delete','bboard_delete_message'); + + -- 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('admin','bboard_moderate_forum'); +end; + + +create function inline_0 () +returns integer as ' +declare + default_context integer; + registered_users integer; + the_public integer; +begin + + default_context := acs__magic_object_id(''default_context''); + registered_users := acs__magic_object_id(''registered_users''); + the_public := acs__magic_object_id(''the_public''); + + -- give registered users the power to post by default + + perform acs_permission__grant_permission ( + default_context, + registered_users, + ''bboard_create_message'' + ); + + -- give the public the power to read by default + + perform acs_permission__grant_permission ( + default_context, + the_public, + ''bboard_read_message'' + ); + + perform acs_permission__grant_permission ( + default_context, + the_public, + ''bboard_read_category'' + ); + + perform acs_permission__grant_permission ( + default_context, + the_public, + ''bboard_read_forum'' + ); + + + return 0; +end; +' language 'plpgsql'; + +select inline_0 (); +drop function inline_0 (); + + +select acs_object_type__create_type ( + 'bboard_forum', + 'BBoard Forum', + 'BBoard Forums', + 'acs_object', + 'BBOARD_FORUMS', + 'FORUM_ID', + null, + 'f', + null, + 'BBOARD_FORUM__NAME' +); + +select acs_object_type__create_type ( + 'bboard_category', + 'BBoard Category', + 'BBoard Categories', + 'acs_object', + 'BBOARD_CATEGORIES', + 'CATEGORY_ID', + null, + 'f', + null, + 'BBOARD_CATEGORY__NAME' +); + +select acs_object_type__create_type ( + 'bboard_message', + 'BBoard Message', + 'BBoard Messages', + 'acs_message', + 'BBOARD_MESSAGES', + 'MESSAGE_ID', + null, + 'f', + null, + null +); + +create table bboard_messages ( + message_id integer + constraint bboard_messages_msg_id_fk + references acs_messages(message_id) + on delete cascade + constraint bboard_messages_msg_id_pk + primary key +); + +-- bboard forums +-- +-- these act as primary containers for messages +-- a message's context_id will point to its forum + +create table bboard_forums ( + forum_id integer + constraint bboard_forums_forum_id_fk + references acs_objects (object_id) + constraint bboard_forums_pk + primary key, + short_name varchar(400) + constraint bboard_forums_short_name_nn + not null, + charter varchar(4000), + moderated_p char(1) + constraint bboard_forums_moderated_p_nn + not null + constraint bboard_forums_moderated_p_ck + check (moderated_p in ('t','f')), + bboard_id integer + constraint bboard_forums_bboard_id_nn + not null + constraint bboard_forums_bboard_id_fk + references apm_packages (package_id) + on delete cascade +); + +create index bboard_forums_bboard_id_idx + on bboard_forums (bboard_id); + +create table bboard_forum_message_map ( + forum_id integer + constraint bboard_fmm_forum_id_fk + references bboard_forums (forum_id) + on delete cascade, + message_id integer + constraint bboard_fmm_message_id_fk + references bboard_messages (message_id) + on delete cascade, + status varchar(20) + constraint bboard_fmm_status_ck + check (status in ('unmoderated', 'approved', 'rejected')) + constraint bboard_fmm_status_nn + not null, + last_reply_date timestamptz, + num_replies integer, + constraint bboard_forum_message_map_pk + primary key (forum_id, message_id) +); + +create index bboard_fmm_message_id_idx + on bboard_forum_message_map (message_id); + +create index bboard_fmm_status_idx + on bboard_forum_message_map (status); + +-- bboard categories +-- +-- these are for intra-forum categorization +-- categories will be scoped to forums via their acs_object.context_id + +create table bboard_categories ( + category_id integer + constraint bboard_c_category_id_fk + references acs_objects (object_id) + on delete cascade + constraint bboard_c_category_id_pk + primary key, + short_name varchar(400) + constraint bboard_c_short_name_nn + not null, + forum_id integer + constraint bboard_c_forum_id_fk + references bboard_forums (forum_id) + on delete cascade + constraint bboard_c_forum_id_nn + not null, + description varchar(4000) +); + +create index bboard_categories_forum_id_idx + on bboard_categories (forum_id); + +create table bboard_category_message_map ( + category_id integer + constraint bboard_cmm_category_id_fk + references bboard_categories (category_id) + on delete cascade, + message_id integer + constraint bboard_cmm_message_id_fk + references bboard_messages (message_id) + on delete cascade, + constraint bboard_category_message_map_pk + primary key (category_id, message_id) +); + +create index bboard_cmm_message_id_idx + on bboard_category_message_map (message_id); + +-- @@ bboard-views + +-- Tables to track subscriptions + +create table bboard_forum_subscribers ( + forum_id integer + constraint bboard_fs_forum_id_fk + references bboard_forums (forum_id) + on delete cascade, + subscriber_id integer + constraint bboard_fs_subscriber_id_fk + references parties (party_id) + on delete cascade, + constraint bboard_forum_subscribers_pk + primary key (forum_id, subscriber_id) +); + +create index bboard_fs_subscriber_id_idx + on bboard_forum_subscribers (subscriber_id); + +create table bboard_category_subscribers ( + category_id integer + constraint bboard_cs_category_id_fk + references bboard_categories (category_id) + on delete cascade, + subscriber_id integer + constraint bboard_cs_subscriber_id_fk + references parties (party_id) + on delete cascade, + constraint bboard_category_subscribers_pk + primary key (category_id, subscriber_id) +); + +create index bboard_cs_subscriber_id_idx + on bboard_category_subscribers (subscriber_id); + +create table bboard_thread_subscribers ( + thread_id integer + constraint bboard_ts_thread_id_fk + references bboard_messages (message_id) + on delete cascade, + subscriber_id integer + constraint bboard_ts_subscriber_id_fk + references parties (party_id) + on delete cascade, + constraint bboard_thread_subscribers_pk + primary key (thread_id, subscriber_id) +); + +create index bboard_ts_subscriber_id_idx + on bboard_thread_subscribers (subscriber_id); + +\i bboard-views.sql +\i bboard-packages.sql + +-- Now created when content-repository loaded. +-- insert into cr_mime_types (mime_type) +-- values ('text/plain; format=flowed'); + Index: openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-drop.sql 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,146 @@ +-- +-- packages/message/sql/bboard-drop.sql +-- +-- @author jmp@arsdigita.com +-- @creation-date 2000-08-31 +-- @cvs-id $Id: bboard-drop.sql,v 1.6 2003/08/28 09:41:47 lars Exp $ +-- + +-- This drop script destroys all messages that belong to forums. +-- It should handle any permission changes that have been done since +-- install by removing any permissions having to do with the standard +-- bboard permissions. + +-- We need to get rid of things that might be referring to +-- bboard objects that would prevent removal. This includes: +-- email-a-friend droppings +-- attachments (files and images) + +-- if something else is pointing at one of our messages, this script +-- will fail and removing bboard will be icky. this is sort of hairy +-- problem with unknown potential intra-package references. + + +create function inline_0 () +returns integer as ' + begin + raise NOTICE ''currently it is impossible to delete multiple threads within a transaction. please ensure you have removed all forums through the admin interface before you try to drop the package.''; + return 0; + end; +' language 'plpgsql'; + +select inline_0 (); +drop function inline_0(); + + +-- Delete all subscriptions +delete from bboard_thread_subscribers; +delete from bboard_category_subscribers; +delete from bboard_forum_subscribers; + +-- Delete all categories +delete from bboard_category_message_map; +delete from bboard_categories; +delete from acs_objects where object_type = 'bboard_category'; + +-- Delete all forums +delete from bboard_forum_message_map; +delete from bboard_forums; +delete from acs_objects where object_type = 'bboard_forum'; + +-- Delete mime types we created +delete from cr_mime_types where mime_type='text/plain; format=flowed'; + +-- Drop all schema objects + +drop function bboard_forum__forum_p (integer); +drop function bboard_forum__new (integer, varchar, varchar, char, integer, + integer, timestamptz, integer, varchar, varchar); +drop function bboard_forum__delete (integer); +drop function bboard_forum__set_attrs (integer, varchar, varchar, char, integer); +drop function bboard_forum__subscribe (integer, integer); +drop function bboard_forum__forum_containing_message (integer); +drop function bboard_forum__name (integer); +drop function bboard_category__category_p (integer); +drop function bboard_category__new (integer, varchar, varchar, integer, + integer, timestamptz, integer, varchar, varchar); +drop function bboard_category__delete (integer); +drop function bboard_category__set_attrs (integer, varchar, varchar, integer); +drop function bboard_category__subscribe (integer, integer); +drop function bboard_category__name (integer); +drop function bboard_message__new (integer, integer, timestamptz, integer, + varchar, varchar, varchar, varchar, text, + integer, timestamptz, integer, varchar, varchar); +drop function bboard_message__message_p (integer); +drop function bboard_message__set_attrs (integer, integer, timestamptz, + integer, varchar, varchar, integer); +drop function bboard_message__set_status (integer, integer, varchar); +drop function bboard_message__add_category (integer, integer); +drop function bboard_message__remove_category (integer, integer); +drop function bboard_message__clear_categories (integer); +drop function bboard_message__subscribe (integer, integer); +drop function bboard_message__remove_thread (integer); +drop function bboard_message__remove (integer); + + + +drop view bboard_messages_by_category; +drop view bboard_messages_all; +drop table bboard_thread_subscribers; +drop table bboard_category_subscribers; +drop table bboard_forum_subscribers; +drop table bboard_category_message_map; +drop table bboard_categories; +drop table bboard_forum_message_map; +drop table bboard_forums; +drop table bboard_messages; + +-- Drop object type metadata +begin; + select acs_object_type__drop_type ('bboard_forum', 'f'); + select acs_object_type__drop_type ('bboard_category', 'f'); + select acs_object_type__drop_type ('bboard_message', 'f'); +end; + + +-- Drop permission metadata +delete from acs_permissions + where privilege in + ('bboard_create_forum', 'bboard_create_category', + 'bboard_create_message', 'bboard_write_forum', + 'bboard_write_category', 'bboard_write_message', + 'bboard_read_forum', 'bboard_read_category', + 'bboard_read_message', 'bboard_delete_forum', + 'bboard_delete_category', 'bboard_delete_message', + 'bboard_moderate_forum'); + +delete from acs_privilege_hierarchy + where privilege in + ('bboard_create_forum', 'bboard_create_category', + 'bboard_create_message', 'bboard_write_forum', + 'bboard_write_category', 'bboard_write_message', + 'bboard_read_forum', 'bboard_read_category', + 'bboard_read_message', 'bboard_delete_forum', + 'bboard_delete_category', 'bboard_delete_message', + 'bboard_moderate_forum'); + +delete from acs_privilege_hierarchy + where child_privilege in + ('bboard_create_forum', 'bboard_create_category', + 'bboard_create_message', 'bboard_write_forum', + 'bboard_write_category', 'bboard_write_message', + 'bboard_read_forum', 'bboard_read_category', + 'bboard_read_message', 'bboard_delete_forum', + 'bboard_delete_category', 'bboard_delete_message', + 'bboard_moderate_forum'); + +delete from acs_privileges + where privilege in + ('bboard_create_forum', 'bboard_create_category', + 'bboard_create_message', 'bboard_write_forum', + 'bboard_write_category', 'bboard_write_message', + 'bboard_read_forum', 'bboard_read_category', + 'bboard_read_message', 'bboard_delete_forum', + 'bboard_delete_category', 'bboard_delete_message', + 'bboard_moderate_forum'); + Index: openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-packages.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-packages.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-packages.sql 28 Aug 2003 09:41:47 -0000 1.10 @@ -0,0 +1,576 @@ +-- +-- packages/bboard/sql/bboard-packages.sql +-- +-- @author Anukul Kapoor +-- @author John Prevost +-- @creation-date 2000-11-22 +-- @cvs-id $Id: bboard-packages.sql,v 1.10 2003/08/28 09:41:47 lars Exp $ +-- + +------------ bboard_forum package --------------- + +create function bboard_forum__forum_p (integer) +returns char as ' +declare + p_forum_id alias for $1; + v_check_forum_id integer; +begin + select count(forum_id) into v_check_forum_id + from bboard_forums + where forum_id = p_forum_id; + if v_check_forum_id = 1 then + return ''t''; + else + return ''f''; + end if; +end; +' language 'plpgsql'; + + +create function bboard_forum__new (integer, varchar, varchar, char, integer, + integer, timestamptz, integer, varchar, varchar) +returns integer as ' +declare + p_forum_id alias for $1; -- default null + p_short_name alias for $2; + p_charter alias for $3; -- default null + p_moderated_p alias for $4; -- default ''f'' + p_bboard_id alias for $5; + p_context_id alias for $6; -- default null + p_creation_date alias for $7; -- default now() + p_creation_user alias for $8; -- default null + p_creation_ip alias for $9; -- default null + p_object_type alias for $10; -- default ''bboard_forum'' + v_context_id integer; + v_forum_id integer; +begin + v_context_id := coalesce(p_context_id, p_bboard_id); + v_forum_id := acs_object__new ( + p_forum_id, + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + v_context_id + ); + + insert into bboard_forums + (forum_id, short_name, charter, moderated_p, bboard_id) + values (v_forum_id, p_short_name, p_charter, p_moderated_p, p_bboard_id); + return v_forum_id; +end; +' language 'plpgsql'; + + +create function bboard_forum__delete (integer) +returns integer as ' +declare + p_forum_id alias for $1; +begin + delete from bboard_forums + where forum_id = p_forum_id; + PERFORM acs_object__delete(p_forum_id); + return 0; +end; +' language 'plpgsql'; + + +create function bboard_forum__set_attrs (integer, varchar, varchar, char, integer) +returns integer as ' +declare + p_forum_id alias for $1; + p_short_name alias for $2; -- default null + p_charter alias for $3; -- default null + p_moderated_p alias for $4; -- default null + p_bboard_id alias for $5; -- default null + v_check_forum_id integer; +begin + select count(forum_id) into v_check_forum_id + from bboard_forums + where forum_id = p_forum_id; + -- Not a forum. Fail silently? + if v_check_forum_id <> 1 then + return -1; + end if; + if p_short_name is not null then + update bboard_forums set short_name = p_short_name + where forum_id = p_forum_id; + end if; + update bboard_forums set charter = p_charter + where forum_id = p_forum_id; + if p_moderated_p is not null then + update bboard_forums set moderated_p = p_moderated_p + where forum_id = p_forum_id; + end if; + if p_bboard_id is not null then + update bboard_forums set bboard_id = p_bboard_id + where forum_id = p_forum_id; + update acs_objects set context_id = p_bboard_id + where object_id = p_forum_id; + end if; + return 0; +end; +' language 'plpgsql'; + + +create function bboard_forum__subscribe (integer, integer) +returns integer as ' +declare + p_forum_id alias for $1; + p_subscriber_id alias for $2; +begin + insert into bboard_forum_subscribers (forum_id, subscriber_id) + values (p_forum_id, p_subscriber_id); + return 0; +end; +' language 'plpgsql'; + + +create function bboard_forum__forum_containing_message (integer) +returns integer as ' +declare + p_message_id alias for $1; + v_forum_id integer; +begin + select max(forum_id) into v_forum_id + from bboard_forum_message_map + where message_id = p_message_id; + + if v_forum_id is null then + return 0; + else + return v_forum_id; + end if; +end; +' language 'plpgsql'; + + +create function bboard_forum__name (integer) +returns varchar as ' +declare + p_forum_id alias for $1; + v_forum_name varchar; +begin + select short_name into v_forum_name + from bboard_forums + where forum_id = p_forum_id; + return v_forum_name; +end; +' language 'plpgsql'; + + +---------- bboard_category package --------------- + +create function bboard_category__category_p (integer) +returns char as ' +declare + p_category_id alias for $1; + v_check_category_id integer; +begin + select count(category_id) into v_check_category_id + from bboard_categories + where category_id = p_category_id; + if v_check_category_id = 1 then + return ''t''; + else + return ''f''; + end if; +end; +' language 'plpgsql'; + + +create function bboard_category__new (integer, varchar, varchar, integer, + integer, timestamptz, integer, varchar, varchar) +returns integer as ' +declare + p_category_id alias for $1; -- default null + p_short_name alias for $2; + p_description alias for $3; -- default null + p_forum_id alias for $4; + p_context_id alias for $5; -- default null + p_creation_date alias for $6; -- default now() + p_creation_user alias for $7; -- default null + p_creation_ip alias for $8; -- default null + p_object_type alias for $9; -- default ''bboard_category'' + v_category_id integer; + v_context_id integer; +begin + v_context_id := coalesce(p_context_id, p_forum_id); + v_category_id := acs_object__new ( + p_category_id, + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + v_context_id + ); + + insert into bboard_categories + (category_id, short_name, description, forum_id) + values (v_category_id, p_short_name, p_description, p_forum_id); + + return v_category_id; +end; +' language 'plpgsql'; + + +create function bboard_category__delete (integer) +returns integer as ' +declare + p_category_id alias for $1; +begin + delete from bboard_categories + where category_id = p_category_id; + PERFORM acs_object__delete(p_category_id); + return 0; +end; +' language 'plpgsql'; + + +create function bboard_category__set_attrs (integer, varchar, varchar, integer) +returns integer as ' +declare + p_category_id alias for $1; + p_short_name alias for $2; -- default null + p_description alias for $3; -- default null + p_forum_id alias for $4; -- default null + v_check_category_id integer; +begin + select count(category_id) into v_check_category_id + from bboard_categories + where category_id = p_category_id; + -- Not a category. Fail silently? + if v_check_category_id <> 1 then + return -1; + end if; + -- It is a category. Go for it. + if p_short_name is not null then + update bboard_categories set short_name = p_short_name + where category_id = p_category_id; + end if; + if p_description is not null then + update bboard_categories set description = p_description + where category_id = p_category_id; + end if; + if p_forum_id is not null then + update bboard_categories set forum_id = p_forum_id + where category_id = p_category_id; + update acs_objects set context_id = p_forum_id + where object_id = p_category_id; + end if; + return 0; +end; +' language 'plpgsql'; + +create function bboard_category__subscribe (integer, integer) +returns integer as ' +declare + p_category_id alias for $1; + p_subscriber_id alias for $2; +begin + insert into bboard_category_subscribers (category_id, subscriber_id) + values (p_category_id, p_subscriber_id); + return 0; +end; +' language 'plpgsql'; + +create function bboard_category__name (integer) +returns varchar as ' +declare + p_category_id alias for $1; + v_category_name varchar; +begin + select short_name into v_category_name + from bboard_categories + where category_id = p_category_id; + return v_category_name; +end; +' language 'plpgsql'; + +--------------- bboard_message package ---------------- + +create function bboard_message__new (integer, integer, timestamptz, integer, + varchar, varchar, varchar, varchar, text, + integer, timestamptz, integer, varchar, varchar) +returns integer as ' +declare + p_message_id alias for $1; -- default null + p_reply_to alias for $2; -- default null + p_sent_date alias for $3; -- default sysdate + p_sender alias for $4; -- default null + p_rfc822_id alias for $5; -- default null + p_title alias for $6; -- default null + p_mime_type alias for $7; -- default ''text/plain'' + p_text alias for $8; -- default null + p_data alias for $9; -- default null + p_context_id alias for $10; -- default 0 + p_creation_date alias for $11; -- default sysdate + p_creation_user alias for $12; -- default null + p_creation_ip alias for $13; -- default null + p_object_type alias for $14; -- default ''bboard_message'' + v_message_id bboard_messages.message_id%TYPE; + v_sent_date timestamptz; +begin + v_sent_date := coalesce(p_sent_date, now()); + + v_message_id := acs_message__new ( + p_message_id, + p_reply_to, + v_sent_date, + p_sender, + p_rfc822_id, + p_title, + null, + p_mime_type, + p_text, + p_data, + 0, + p_context_id, + p_creation_user, + p_creation_ip, + p_object_type, + ''t'' + ); + + insert into bboard_messages + (message_id) + values + (v_message_id); + + return v_message_id; +end; +' language 'plpgsql'; + + +create function bboard_message__message_p (integer) +returns char as ' +declare + p_message_id alias for $1; + v_check_message_id integer; +begin + select count(message_id) into v_check_message_id + from bboard_messages + where message_id = p_message_id; + if v_check_message_id = 1 then + return ''t''; + else + return ''f''; + end if; +end; +' language 'plpgsql'; + + +create function bboard_message__set_attrs (integer, integer, timestamptz, + integer, varchar, varchar, integer) +returns integer as ' +declare + p_message_id alias for $1; + p_reply_to alias for $2; -- default null + p_sent_date alias for $3; -- default null + p_sender alias for $4; -- default null + p_title alias for $5; -- default null + p_mime_type alias for $6; -- default null + p_context_id alias for $7; -- default null + v_check_message_id integer; + v_revision_id integer; +begin + if bboard_message__message_p(p_message_id) = ''f'' then + return -1; + end if; + + -- modify the parts that are in acs_messages + + if p_reply_to is not null then + update acs_messages set reply_to = p_reply_to + where message_id = p_message_id; + end if; + if p_sent_date is not null then + update acs_messages set sent_date = p_sent_date + where message_id = p_message_id; + end if; + if p_sender is not null then + update acs_messages set sender = p_sender + where message_id = p_message_id; + end if; + + -- modify the parts that are in cr_revisions + if p_title is not null or p_mime_type is not null then + select live_revision into v_revision_id + from cr_items where item_id = p_message_id + for update; + if p_title is not null then + update cr_revisions set title = p_title + where revision_id = v_revision_id; + end if; + if p_mime_type is not null then + update cr_revisions set mime_type = p_mime_type + where revision_id = v_revision_id; + end if; + end if; + + -- modify the context_id in acs_objects + + if p_context_id is not null then + update acs_objects set context_id = p_context_id + where object_id = p_message_id; + end if; + + return 0; +end; +' language 'plpgsql'; + + +create function bboard_message__set_status (integer, integer, varchar) +returns integer as ' +declare + p_message_id alias for $1; + p_forum_id alias for $2; + p_status alias for $3; +begin + if bboard_message__message_p(p_message_id) = ''f'' + or bboard_forum__forum_p(p_forum_id) = ''f'' then + return -1; + end if; + delete from bboard_forum_message_map + where message_id = p_message_id + and forum_id = p_forum_id; + if p_status is not null then + insert into bboard_forum_message_map (forum_id, message_id, status) + values (p_forum_id, p_message_id, p_status); + end if; + + return 0; +end; +' language 'plpgsql'; + + +create function bboard_message__add_category (integer, integer) +returns integer as ' +declare + p_message_id alias for $1; + p_category_id alias for $2; +begin + insert into bboard_category_message_map (message_id, category_id) + values (p_message_id, p_category_id); + return 0; +end; +' language 'plpgsql'; + + +create function bboard_message__remove_category (integer, integer) +returns integer as ' +declare + p_message_id alias for $1; + p_category_id alias for $2; +begin + delete from bboard_category_message_map + where category_id = p_category_id + and message_id = p_message_id; + return 0; +end; +' language 'plpgsql'; + + +create function bboard_message__clear_categories (integer) +returns integer as ' +declare + p_message_id alias for $1; +begin + delete from bboard_category_message_map + where message_id = p_message_id; + return 0; +end; +' language 'plpgsql'; + + +create function bboard_message__subscribe (integer, integer) +returns integer as ' +declare + p_thread_id alias for $1; + p_subscriber_id alias for $2; +begin + insert into bboard_thread_subscribers (thread_id, subscriber_id) + values (p_thread_id, p_subscriber_id); + return 0; +end; +' language 'plpgsql'; + + +create function bboard_message__remove_thread (integer) +returns integer as ' +declare + thread_id alias for $1; + child_val record; + message_val record; + image_p integer; + v_search_key varbit; +begin + select tree_sortkey into v_search_key + from acs_messages + where message_id = thread_id; + + for child_val in + select object_id as child_id, object_type + from acs_objects o, acs_messages m + where o.context_id = m.message_id + and m.tree_sortkey between v_search_key and tree_right(v_search_key) + loop + if child_val.object_type = ''bboard_message'' then + perform acs_message__delete(child_val.child_id); + elsif child_val.object_type = ''content_item'' then + select count(*) into image_p + from images + where image_id = child_val.child_id; + if image_p = 1 then + perform acs_message__delete_image(child_val.child_id); + else + perform acs_message__delete_file(child_val.child_id); + end if; + end if; + end loop; + + for message_val in + select message_id + from acs_messages + where tree_sortkey between v_search_key and tree_right(v_search_key) + loop + perform acs_message__delete(message_val.message_id); + end loop; + + return 0; +end; +' language 'plpgsql'; + + +create function bboard_message__remove (integer) +returns integer as ' +declare + message_id alias for $1; + child_val record; + image_p integer; +begin + for child_val in + select object_id as child_id, object_type + from acs_objects + where context_id = message_id + loop + if child_val.object_type = ''bboard_message'' then + perform acs_message__delete(child_val.child_id); + else if child_val.object_type = ''content_item'' then + select count(*) into image_p + from images + where image_id = child_val.child_id; + if image_p = 1 then + perform acs_message__delete_image(child_val.child_id); + + else + + perform acs_message__delete_file(child_val.child_id); + end if; + end if; end if; + end loop; + + perform acs_message__delete(message_id); + return 0; +end; +' language 'plpgsql'; Index: openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-views.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-views.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/sql/postgresql/bboard-views.sql 28 Aug 2003 09:41:47 -0000 1.7 @@ -0,0 +1,37 @@ +-- +-- packages/bboard/sql/bboard-views.sql +-- +-- @author Anukul Kapoor +-- @author John Prevost +-- @creation-date 2001-02-05 +-- @cvs-id $Id: bboard-views.sql,v 1.7 2003/08/28 09:41:47 lars Exp $ +-- + +-- DRB: This view is several orders of magnitude faster than the old one +-- using "in". It would be nice to avoid having two aggregate subselects +-- but there's no easy way to to do this. + +-- Also ... Postgres does seem to optimize away the two subselects that +-- calculate the number of replies and last reply date if the query +-- using the view doesn't include those columns in its resultset. So +-- at the moment it does not appear necessary to create simpler views +-- with those stripped out. + +create view bboard_messages_all as + select m.message_id, m.reply_to, m.sent_date, m.sender, + m.title, m.mime_type, m.content, f.forum_id, f.status, + (select count(1) from acs_messages m2, bboard_forum_message_map mf + where m2.message_id = mf.message_id + and m2.tree_sortkey between m.tree_sortkey and tree_right(m.tree_sortkey)) + as num_replies, + (select max(sent_date) from acs_messages m2, bboard_forum_message_map mf + where m2.message_id = mf.message_id + and m2.tree_sortkey between m.tree_sortkey and tree_right(m.tree_sortkey)) + as last_reply_date + from acs_messages_all m, bboard_forum_message_map f + where m.message_id = f.message_id; + +create view bboard_messages_by_category as + select msg.*, cat.category_id + from bboard_messages_all msg left join bboard_category_message_map cat on (msg.message_id = cat.message_id); + Index: openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-init.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-init.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,11 @@ +ad_library { + + bboard init - sets up scheduled procs + + @cvs-id $Id: bboard-init.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ + @author Anukul Kapoor + @creation-date 2001-02-13 + +} + +ad_schedule_proc -thread t 86400 bboard_garbage_collect \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-oracle.xql 28 Aug 2003 09:41:47 -0000 1.8 @@ -0,0 +1,495 @@ + + + + oracle8.1.6 + + + + + begin + :1 := bboard_forum.forum_p(:forum_id); + end; + + + + + + + + + begin + :1 := bboard_forum.new ( + forum_id => :forum_id, + short_name => :short_name, + charter => :charter, + moderated_p => :moderated_p, + bboard_id => :bboard_id, + context_id => :context_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + + + + + + + + + begin + bboard_forum.set_attrs ( + forum_id => :forum_id, + short_name => :short_name, + charter => :charter, + moderated_p => :moderated_p, + bboard_id => :bboard_id + ); + end; + + + + + + + + + begin + :1 := bboard_category.category_p(:category_id); + end; + + + + + + + + + begin + :1 := bboard_category.new ( + category_id => :category_id, + short_name => :short_name, + description => :description, + forum_id => :forum_id + ); + end; + + + + + + + + + begin + bboard_category.set_attrs ( + category_id => :category_id, + short_name => :short_name, + description => :description, + forum_id => :forum_id + ); + end; + + + + + + + + + begin + :1 := bboard_message.new ( + message_id => :message_id, + reply_to => :reply_to, + sent_date => :sent_date, + sender => :sender, + title => :title, + mime_type => :mime_type, + data => empty_blob(), + context_id => :context_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + + + + + + + + + update cr_revisions + set content = empty_blob() + where revision_id = :revision_id + returning content into :1 + + + + + + + + + begin + bboard_message.set_attrs ( + message_id => :message_id, + reply_to => :reply_to, + sent_date => :sent_date, + sender => :sender, + title => :title, + mime_type => :mime_type, + context_id => :context_id + ); + end; + + + + + + + + + update cr_revisions + set content = empty_blob() + where revision_id = :revision_id + returning content into :1 + + + + + + + + + begin + bboard_message.clear_categories ( :message_id ); + end; + + + + + + + + + begin + bboard_message.add_category ( + message_id => :message_id, + category_id => :category_id + ); + end; + + + + + + + + + begin + bboard_message.remove_category ( + message_id => :message_id, + category_id => :category_id + ); + end; + + + + + + + + + begin + bboard_message.set_status ( + message_id => :message_id, + forum_id => :forum_id, + status => :status + ); + end; + + + + + + + + + begin + bboard_forum.subscribe ( + forum_id => :forum_id, + subscriber_id => :subscriber_id + ); + end; + + + + + + + + + begin + bboard_category.subscribe ( + category_id => :category_id, + subscriber_id => :subscriber_id + ); + end; + + + + + + + + + begin + bboard_message.subscribe ( + thread_id => :thread_id, + subscriber_id => :subscriber_id + ); + end; + + + + + + + + + select count(*) as subscribed_p from bboard_thread_subscribers + where subscriber_id = :user_id + and thread_id in (select message_id + from acs_messages b + connect by b.message_id = prior b.reply_to + start with message_id = :message_id) + + + + + + + + + + select bboard_forum.forum_containing_message(:message_id) as forum_id + from dual + + + + + + + + + select acs_message.first_ancestor(:message_id) as ancestor_id + from dual + + + + + + + + + begin + :1 := acs_message.new_image ( + message_id => :message_id, + image_id => :file_id, + file_name => :short_filename, + title => :title, + mime_type => :mime_type, + content => empty_blob(), + width => :width, + height => :height, + creation_user => :user_id, + creation_ip => :creation_ip, + is_live => 't' + ); + end; + + + + + + + + + select content_item.get_latest_revision(:file_id) as revision_id + from dual + + + + + + + + + update cr_revisions + set filename = :filename, + content_length = :file_size + where revision_id = :revision_id + + + + + + + + + begin + :1 := acs_message.new_file ( + message_id => :message_id, + file_id => :file_id, + file_name => :short_filename, + title => :title, + mime_type => :mime_type, + content => empty_blob(), + creation_user => :user_id, + creation_ip => :creation_ip, + is_live => 't' + ); + end; + + + + + + + + + select content_item.get_latest_revision(:file_id) as revision_id + from dual + + + + + + + + + update cr_revisions + set filename = :filename, + content_length = :file_size + where revision_id = :revision_id + + + + + + + + + select image_id + from images + where image_id = content_item.get_latest_revision(:file_id) + + + + + + + + + begin + acs_message.delete_image(:file_id); + end; + + + + + + + + + begin + acs_message.delete_file(:file_id); + end; + + + + + + + + +update cr_items + set latest_revision=null, live_revision=null + where item_id = -1; + + + + + + + + declare + cursor alerts_cursor is + + select object_id + from acs_objects + where object_id in (select object_id + from acs_objects + where object_type = 'bboard_message' + start with context_id in (select forum_id + from bboard_forums) + connect by prior object_id = context_id) + and object_id not in (select message_id + from bboard_forum_message_map) + order by object_id desc; + begin + for alert_val in alerts_cursor loop + bboard_message.remove(alert_val.object_id); + end loop; + end; + + + + + + + select subscriber_id as recipient_id, thread_id as grouping_id, + sysdate as wait_until + from bboard_thread_subscribers s + where s.thread_id in (select message_id + from acs_messages + start with message_id = :message_id + connect by message_id = prior reply_to) + and s.subscriber_id in (select party_id + from all_object_party_privilege_map + where object_id = :message_id + and privilege = 'bboard_read_message') + + + + + + select s.subscriber_id as recipient_id, s.category_id as grouping_id, + sysdate as wait_until + from bboard_category_subscribers s, bboard_category_message_map m + where m.message_id = :message_id + and s.category_id = m.category_id + and s.subscriber_id in (select party_id + from acs_object_party_privilege_map + where object_id = :message_id + and privilege = 'bboard_read_message') + + + + + + + select s.subscriber_id as recipient_id, s.forum_id as grouping_id, + sysdate as wait_until + from bboard_forum_subscribers s, bboard_forum_message_map m + where m.message_id = :message_id + and s.forum_id = m.forum_id + and s.subscriber_id in (select party_id + from acs_object_party_privilege_map + where object_id = :message_id + and privilege = 'bboard_read_message') + + + + Index: openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs-postgresql.xql 28 Aug 2003 09:41:47 -0000 1.14 @@ -0,0 +1,455 @@ + + + + postgresql7.1 + + + + select bboard_forum__forum_p(:forum_id); + + + + + + + select bboard_forum__new ( + :forum_id, + :short_name, + :charter, + :moderated_p, + :bboard_id, + :context_id, + now(), + :creation_user, + :creation_ip, + 'bboard_forum' + ); + + + + + + + select bboard_forum__set_attrs ( + :forum_id, + :short_name, + :charter, + :moderated_p, + :bboard_id + ); + + + + + + + select bboard_category__category_p(:category_id); + + + + + + + select bboard_category__new ( + :category_id, + :short_name, + :description, + :forum_id, + null, + now(), + null, + null, + 'bboard_category' + ); + + + + + + + select bboard_category__set_attrs ( + :category_id, + :short_name, + :description, + :forum_id + ); + + + + + + + select bboard_message__new ( + :message_id, + :reply_to, + :sent_date, + :sender, + null, -- rfc822_id + :title, + :mime_type, + null, -- text + null, -- data + :context_id, + now(), + :creation_user, + :creation_ip, + 'bboard_message' + ); + + + + + + + + update cr_revisions + set content = :content + where revision_id = :revision_id + + + + + + + + + select bboard_message__set_attrs ( + :message_id, + :reply_to, + :sent_date, + :sender, + :title, + :mime_type, + :context_id + ); + + + + + + + + update cr_revisions + set content = :content + where revision_id = :revision_id + + + + + + + + select bboard_message__clear_categories ( :message_id ); + + + + + + + + + select bboard_message__add_category ( + :message_id, + :category_id + ); + + + + + + + + + select bboard_message__remove_category ( + :message_id, + :category_id + ); + + + + + + + + + select bboard_message__set_status ( + :message_id, + :forum_id, + :status + ); + + + + + + + + + select bboard_forum__subscribe ( + :forum_id, + :subscriber_id + ); + + + + + + + + + select bboard_category__subscribe ( + :category_id, + :subscriber_id + ); + + + + + + + + + select bboard_message__subscribe ( + :thread_id, + :subscriber_id + ); + + + + + + + + + select count(*) as subscribed_p + from bboard_thread_subscribers bs, acs_messages m, acs_messages m2 + where bs.subscriber_id = :user_id + and bs.thread_id = m.message_id + and m2.message_id = :message_id + and m.tree_sortkey between m2.tree_sortkey and tree_right(m2.tree_sortkey) + + + + + + + + + select bboard_forum__forum_containing_message(:message_id) as forum_id + + + + + + + + + + select acs_message__first_ancestor(:message_id) as ancestor_id + + + + + + + + + + select acs_message__new_image ( + :message_id, + :file_id, + :short_filename, + :title, + null, -- description + :mime_type, + null, -- data + :width, + :height, + now(), + :user_id, + :creation_ip, + 't', -- is_live + 'file' + ); + + + + + + + + + select content_item__get_latest_revision(:file_id) as revision_id + + + + + + + + + update cr_revisions + set content = :filename, + content_length = :file_size + where revision_id = :revision_id + + + + + + + select acs_message__new_file ( + :message_id, + :file_id, + :short_filename, + :title, + null, -- description + :mime_type, + null, -- content + now(), + :user_id, + :creation_ip, + 't', -- is_live + 'file' + ); + + + + + + + + + select content_item__get_latest_revision(:file_id) as revision_id + + + + + + + + + update cr_revisions + set content = :filename, + content_length = :file_size + where revision_id = :revision_id + + + + + + + + select image_id + from images + where image_id = content_item__get_latest_revision(:file_id) + + + + + + + + + select acs_message__delete_image(:file_id); + + + + + + + + + select acs_message__delete_file(:file_id); + + + + + + + + + + select object_id as message_id + from acs_objects o + where o.object_type = 'bboard_message' + and not exists (select 1 + from bboard_forum_message_map bfmm, acs_objects o2 + where o2.object_id = bfmm.message_id and + o.tree_sortkey between o2.tree_sortkey and tree_right(o2.tree_sortkey)) + + + + + + + + + update cr_items + set latest_revision=null, live_revision=null + where item_id = :message_id + + + + + + + + + select bboard_message__remove(:message_id); + + + + + + + + select s.subscriber_id as recipient_id, s.thread_id as grouping_id, + now() as wait_until + from bboard_thread_subscribers s, acs_messages m, + (select tree_ancestor_keys(acs_message_get_tree_sortkey(:message_id)) as tree_sortkey) parents + where s.thread_id = m.message_id + and m.tree_sortkey = parents.tree_sortkey + and exists (select 1 + from all_object_party_privilege_map map + where map.object_id = :message_id and + map.party_id = s.subscriber_id and + privilege = 'bboard_read_message') + + + + + + + + select s.subscriber_id as recipient_id, s.category_id as grouping_id, + now() as wait_until + from bboard_category_subscribers s, bboard_category_message_map m + where m.message_id = :message_id + and s.category_id = m.category_id + and exists (select 1 + from all_object_party_privilege_map map + where map.object_id = :message_id and + map.party_id = s.subscriber_id and + privilege = 'bboard_read_message') + + + + + + + + select s.subscriber_id as recipient_id, s.forum_id as grouping_id, + now() as wait_until + from bboard_forum_subscribers s, bboard_forum_message_map m + where m.message_id = :message_id + and s.forum_id = m.forum_id + and exists (select 1 + from all_object_party_privilege_map map + where map.object_id = :message_id and + map.party_id = s.subscriber_id and + privilege = 'bboard_read_message') + + + + Index: openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.tcl 28 Aug 2003 09:41:47 -0000 1.11 @@ -0,0 +1,1014 @@ +ad_library { + + Provides functions for creating and updating bboard messages, forums, + and categories. Also provides functions for constructing queries + for bboard messages. + + @creation-date 2000-10-21 + @author John Prevost + @cvs-id $Id: bboard-procs.tcl,v 1.11 2003/08/28 09:41:47 lars Exp $ + +} + +ad_proc -public bboard_forum_p { + {forum_id} +} { + Check if an integer is a valid bboard forum id. +} { + return [string equal [db_exec_plsql bboard_forum_p { + begin + :1 := bboard_forum.forum_p(:forum_id); + end; + }] "t"] +} + +ad_page_contract_filter bboard_forum_id { name value } { + Checks whether the value (assumed to be an integer) is the id of + an already-existing bboard forum. +} { + # empty is okay (handled by notnull) + if [empty_string_p $value] { + return 1 + } + if ![bboard_forum_p $value] { + ad_complain "$name ($value) does not refer to a valid bboard forum" + return 0 + } + return 1 +} + +ad_proc -public bboard_forum_new { + {-forum_id ""} + {-short_name:required} + {-charter ""} + {-moderated_p f} + {-bboard_id:required} + {-context_id ""} + {-creation_user ""} + {-creation_ip ""} +} { + Create a new forum. +} { + return [db_exec_plsql create_forum { + begin + :1 := bboard_forum.new ( + forum_id => :forum_id, + short_name => :short_name, + charter => :charter, + moderated_p => :moderated_p, + bboard_id => :bboard_id, + context_id => :context_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + }] +} + +ad_proc -public bboard_forum_set { + {-forum_id:required} + {-short_name ""} + {-charter ""} + {-moderated_p ""} + {-bboard_id ""} +} { + Modify some or all of a forum's attributes. +} { + db_exec_plsql update_forum { + begin + bboard_forum.set_attrs ( + forum_id => :forum_id, + short_name => :short_name, + charter => :charter, + moderated_p => :moderated_p, + bboard_id => :bboard_id + ); + end; + } +} + +ad_proc -public bboard_forum_get { + {-forum_id:required} + {-column_array:required} +} { + Get the columns for a given forum into an array variable. +} { + upvar $rowvar row + db_1row forum_get { + select * from bboard_forums where forum_id = :forum_id + } -column_array row +} + +ad_proc -public bboard_category_p { + {category_id} +} { + Check if an integer is a valid bboard category id. +} { + return [string equal [db_exec_plsql bboard_category_p { + begin + :1 := bboard_category.category_p(:category_id); + end; + }] "t"] +} + +ad_page_contract_filter bboard_category_id { name value } { + Checks whether the value (assumed to be an integer) is the id of + an already-existing bboard category. +} { + # empty is okay (handled by notnull) + if [empty_string_p $value] { + return 1 + } + if ![bboard_category_p $value] { + ad_complain "$name ($value) does not refer to a valid bboard category" + return 0 + } + return 1 +} + +ad_proc -public bboard_category_new { + {-category_id ""} + {-short_name:required} + {-description ""} + {-forum_id:required} +} { + Create a new category. +} { + return [db_exec_plsql create_category { + begin + :1 := bboard_category.new ( + category_id => :category_id, + short_name => :short_name, + description => :description, + forum_id => :forum_id + ); + end; + }] +} + +ad_proc -public bboard_category_set { + {-category_id:required} + {-short_name ""} + {-description ""} + {-forum_id ""} +} { + Modify some or all of a category's attributes. +} { + db_exec_plsql update_category { + begin + bboard_category.set_attrs ( + category_id => :category_id, + short_name => :short_name, + description => :description, + forum_id => :forum_id + ); + end; + } +} + +ad_proc -public bboard_category_get { + {-category_id:required} + {-column_array:required} +} { + Get the columns for a given category into an array variable. +} { + upvar $rowvar row + db_1row category_get { + select * from bboard_categories where category_id = :category_id + } -column_array row +} + +ad_proc -public bboard_message_new { + {-message_id ""} + {-reply_to ""} + {-sent_date ""} + {-sender ""} + {-title ""} + {-mime_type ""} + {-content ""} + {-context_id ""} + {-creation_user ""} + {-creation_ip ""} +} { + Create a new message. +} { + set result [db_exec_plsql message_new { + begin + :1 := bboard_message.new ( + message_id => :message_id, + reply_to => :reply_to, + sent_date => :sent_date, + sender => :sender, + title => :title, + mime_type => :mime_type, + data => empty_blob(), + context_id => :context_id, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + }] + + + if [string equal $message_id ""] { + set message_id $result + } + + db_1row message_new_revision { + select live_revision as revision_id + from cr_items + where item_id = :message_id + for update + } + + db_dml message_new_set_blob { + update cr_revisions + set content = empty_blob() + where revision_id = :revision_id + returning content into :1 + } -blobs [list $content] + + return $result +} + +ad_proc -public bboard_message_set { + {-message_id:required} + {-reply_to ""} + {-sent_date ""} + {-sender ""} + {-title ""} + {-mime_type ""} + {-context_id ""} + {-content ""} +} { + Modify one or more attributes of a given message. +} { + db_exec_plsql message_set_attr { + begin + bboard_message.set_attrs ( + message_id => :message_id, + reply_to => :reply_to, + sent_date => :sent_date, + sender => :sender, + title => :title, + mime_type => :mime_type, + context_id => :context_id + ); + end; + } + db_1row message_revision { + select live_revision as revision_id from cr_items + where item_id = :message_id + for update + } + db_dml message_set_content { + update cr_revisions + set content = empty_blob() + where revision_id = :revision_id + returning content into :1 + } -blobs [list $content] +} + +ad_proc -public bboard_message_clear_categories { + {-message_id:required} +} { + Clear all category associations from one message. +} { + db_exec_plsql bboard_message_clear_categories { + begin + bboard_message.clear_categories ( :message_id ); + end; + } +} + +ad_proc -public bboard_message_add_category { + {-message_id:required} + {-category_id:required} +} { + Add one category relationship to a message. +} { + db_exec_plsql bboard_message_add_category { + begin + bboard_message.add_category ( + message_id => :message_id, + category_id => :category_id + ); + end; + } +} + +ad_proc -public bboard_message_remove_category { + {-message_id:required} + {-category_id:required} +} { + Remove one category relationship from a message. +} { + db_exec_plsql bboard_message_remove_category { + begin + bboard_message.remove_category ( + message_id => :message_id, + category_id => :category_id + ); + end; + } +} + +ad_proc -public bboard_message_set_status { + {-message_id:required} + {-forum_id:required} + {-status:required} +} { + Modify the status of a message in a particular forum. Null status is + not in the forum. Acceptable statuses are unmoderated, approved, and + rejected. +} { + db_exec_plsql bboard_message_set_status { + begin + bboard_message.set_status ( + message_id => :message_id, + forum_id => :forum_id, + status => :status + ); + end; + } +} + +ad_proc -public bboard_message_get { + {-message_id:required} + {-column_array:required} +} { + Get the columns for a given message into an array variable. +} { + upvar $rowvar row + db_1row message_get { + select * from acs_messages_all where message_id = :message_id + } -column_array row +} + +ad_proc -public bboard_schedule_sends { + {-message_id:required} + {-email_message_id} +} { + Schedule all message sends for the given message. + + Supports sending an email version of the message given the + optional email_message_id. In this case the message stored with + $email_message_id is sent out to whoever is subscribed to + $message_id. +} { + + # If we don't have a specific message that is to be sent, just use + # the original. + + if ![info exists email_message_id] { + set email_message_id $message_id + } + + # Thread based sends + acs_messaging_send_query -message_id $email_message_id \ + -query [db_map thread_subscribers] \ + -bind [list message_id $message_id] + + # Category based sends + acs_messaging_send_query -message_id $email_message_id \ + -query [db_map category_subscribers] \ + -bind [list message_id $message_id] + + # Forum based sends + acs_messaging_send_query -message_id $email_message_id \ + -query [db_map forum_subscribers] \ + -bind [list message_id $message_id] +} + +ad_proc -public bboard_subscribe_forum { + {-forum_id:required} + {-subscriber_id:required} +} { + Subscribe a user to the given forum (for instant updates, right now.) +} { + db_exec_plsql forum_subscribe { + begin + bboard_forum.subscribe ( + forum_id => :forum_id, + subscriber_id => :subscriber_id + ); + end; + } +} + +ad_proc -public bboard_unsubscribe_forum { + {-forum_id:required} + {-subscriber_id:required} +} { + Unsubscribe a user from the given forum. +} { + db_dml forum_unsubscribe { + delete from bboard_forum_subscribers + where forum_id = :forum_id + and subscriber_id = :subscriber_id + } +} + +ad_proc -public bboard_subscribe_category { + {-category_id:required} + {-subscriber_id:required} +} { + Subscribe a user to the given category (for instant updates, right now.) +} { + db_exec_plsql category_subscribe { + begin + bboard_category.subscribe ( + category_id => :category_id, + subscriber_id => :subscriber_id + ); + end; + } +} + +ad_proc -public bboard_unsubscribe_category { + {-category_id:required} + {-subscriber_id:required} +} { + Unsubscribe a user from the given category. +} { + db_dml category_unsubscribe { + delete from bboard_category_subscribers + where category_id = :category_id + and subscriber_id = :subscriber_id + } +} + +ad_proc -public bboard_subscribe_thread { + {-thread_id:required} + {-subscriber_id:required} +} { + Subscribe a user to the given thread (for instant updates, right now.) +} { + db_exec_plsql thread_subscribe { + begin + bboard_message.subscribe ( + thread_id => :thread_id, + subscriber_id => :subscriber_id + ); + end; + } +} + +ad_proc -public bboard_unsubscribe_thread { + {-thread_id:required} + {-subscriber_id:required} +} { + Unsubscribe a user from the given thread. +} { + db_dml thread_unsubscribe { + delete from bboard_thread_subscribers + where thread_id = :thread_id + and subscriber_id = :subscriber_id + } +} + +ad_proc -public bboard_category_subscribed_p { + {-direct:boolean} + user_id + category_id +} { + Returns "t" or "f" based on whether a user is subscribed to a + particular category. The -direct switch checks only category + subscriptions whereas leaving it off checks for the category, + and any forums the category is in. +} { + db_0or1row check_category_subscribed { + select count(*) as subscribed_p from bboard_category_subscribers + where category_id = :category_id + and subscriber_id = :user_id + } + + if {$subscribed_p > 0} { + return "t" + } else { + if {!$direct_p} { + # if direct isn't defined, we should also check + # for + + db_0or1row check_category_forums_subscribed { + select count(*) as subscribed_p from bboard_forum_subscribers + where subscriber_id = :user_id + and forum_id in (select bc.forum_id + from bboard_categories bc + where bc.category_id = + :category_id) + } + + if {$subscribed_p > 0} { + return "t" + } + } + } + + return "f" +} + +ad_proc -public bboard_forum_subscribed_p { + user_id + forum_id +} { + Returns "t" or "f" based on whether a user is subscribed to a + particular forum, category, or thread. +} { + db_0or1row check_forum_subscribed { + select count(*) as subscribed_p + from bboard_forum_subscribers + where forum_id = :forum_id + and subscriber_id = :user_id + } + + if {$subscribed_p > 0} { + return "t" + } else { + return "f" + } +} + +ad_proc -public bboard_message_subscribed_p { + {-direct:boolean} + user_id + message_id +} { + Returns "t" or "f" based on whether a user is subscribed to a + particular thread. +} { + db_1row check_message_subscribed { + select count(*) as subscribed_p from bboard_thread_subscribers + where subscriber_id = :user_id + and thread_id in (select message_id + from acs_messages b + connect by b.message_id = prior b.reply_to + start with message_id = :message_id) + + } + + if {$subscribed_p > 0} { + return "t" + } else { + if {! $direct_p } { + db_1row check_message_cats_subscribed { + select count(*) as subscribed_p + from bboard_category_subscribers + where subscriber_id = :user_id + and category_id in (select bcmm.category_id + from bboard_category_message_map bcmm + where bcmm.message_id = :message_id) + + } + + if {$subscribed_p > 0} { + return "t" + } else { + db_0or1row check_message_forums_subscribed { + select count(*) as subscribed_p + from bboard_forum_subscribers + where subscriber_id = :user_id + and forum_id in (select bfmm.forum_id + from bboard_forum_message_map bfmm + where bfmm.message_id = :message_id) + } + + if {$subscribed_p > 0} { + return "t" + } + } + } + } + return "f" +} + +ad_proc -public bboard_message_forum { + {message_id} +} { + Returns a forum_id for a forum that the supplied message is in. Returns 0 + if the message id isn't found. +} { + db_1row bboard_forum_containing_message { + select bboard_forum.forum_containing_message(:message_id) as forum_id + from dual + } + + return $forum_id +} + +ad_proc -public bboard_forum_moderated_p { + {forum_id} +} { + Returns "t" if the forum is moderated, "f" otherwise +} { + db_1row forum_moderated_p { + select moderated_p + from bboard_forums + where forum_id = :forum_id + } + + return $moderated_p +} + +ad_proc bboard_message_page { +} { + Returns the appropriate page name to display a message. This + proc consults preferences to determine different display styles. +} { + if {[string compare [ad_parameter "ThreadingEnabledP"] "t"] == 0} { + return "message-threaded" + } else { + return "message" + } +} + +ad_proc -public bboard_message_url { + {-absolute:boolean} + {-top:boolean} + {message_id} + {forum_id ""} +} { + Returns the proper URL for displaying the message with the supplied message_id. + + If given the -absolute flag it will return a full url. + + When the absolute flag is specified, this proc must be called from + within a live page since it depends on ad_conn being around. + +} { + # This is a workaround to a bug in acs-messaging-procs/first_ancestor + # that won't be deployed until after this next bboard release -akk + + if {! $top_p} { + db_1row first_ancestor { + select acs_message.first_ancestor(:message_id) as ancestor_id + from dual + } + } else { + set ancestor_id $message_id + } + + if { $message_id == $ancestor_id } { + set anchor "" + } else { + set anchor "#$message_id" + } + + # if we don't have a forum_id, let's pick one! + + # use of this violates the assumption + # that messages can be in multiple forums + + if [string equal $forum_id ""] { + set forum_id [bboard_message_forum $ancestor_id] + } + + set message_id $ancestor_id + if {$absolute_p} { + set prefix "[ad_conn location][ad_conn package_url]" + } else { + set prefix "" + } + + return "$prefix[bboard_message_page]?message_id=$message_id&forum_id=$forum_id$anchor" +} + +ad_proc -public bboard_subscriptions_url {} { + Returns URL for managing bboard subscriptions. +} { + return "[ad_conn location][ad_conn package_url]subscriptions" +} + +# if i were cool, i'd implement an Omega(log n) solution for this +# i am not however, cool + +ad_proc -public bboard_n_spaces { + {n} +} { + Returns a string containg n HTML spaces i.e &nbsp; +} { + set spaces "" + for {set i 0} {$i < $n} {incr i} { + append spaces " " + } + return $spaces +} + + +ad_proc -public bboard_upload_extension { + {filename} +} { + This proc returns the stripped file extensions of a filename. +} { + # get the file extension + set file_extension [string tolower [file extension $filename]] + + # remove the first . from the file extension + regsub {\.} $file_extension "" file_extension + + return $file_extension +} + +ad_proc -public bboard_upload_basename { + {filename} +} { + This proc attempts to return the base of a passed in filename i.e. + it strips off the C:\directories and associated crud. + e.g. C:\bar\baz\qux.flad -> qux.flad +} { + # strip off the C:\directories... crud and just get the file name + if ![regexp {([^/\\]+)$} $filename match filename] { + # couldn't find a match + set filename $filename + } + + return $filename +} + +ad_proc -public bboard_image_size { + {file_extension} + {filename} +} { + This proc returns a list [width height] from an image if it can determine + this information from the file and file extension. +} { + + set what_aolserver_told_us "" + + if { $file_extension == "jpeg" || $file_extension == "jpg" } { + catch { set what_aolserver_told_us [ns_jpegsize $filename] } + } elseif { $file_extension == "gif" } { + catch { set what_aolserver_told_us [ns_gifsize $filename] } + } + + # the AOLserver jpegsize command has some bugs where the height comes + # through as 1 or 2 + if { ![empty_string_p $what_aolserver_told_us] && + [lindex $what_aolserver_told_us 0] > 10 && + [lindex $what_aolserver_told_us 1] > 10 } { + return $what_aolserver_told_us + } else { + return [list "" ""] + } +} + +ad_proc -public bboard_attach_image { + {-message_id:required} + {-file_id ""} + {-short_filename:required} + {-local_filename:required} + {-mime_type:required} + {-width ""} + {-height ""} + {-title ""} + {-user_id ""} + {-creation_ip ""} +} { + Creates a message image attachment. +} { + db_exec_plsql insert_image { + begin + :1 := acs_message.new_image ( + message_id => :message_id, + image_id => :file_id, + file_name => :short_filename, + title => :title, + mime_type => :mime_type, + content => empty_blob(), + width => :width, + height => :height, + creation_user => :user_id, + creation_ip => :creation_ip, + is_live => 't' + ); + end; + } + + db_1row get_revision { + select content_item.get_latest_revision(:file_id) as revision_id + from dual + } + + set filename [cr_create_content_file $file_id $revision_id $local_filename] + set file_size [file size $local_filename] + + db_dml set_content_size "" +} + +ad_proc -public bboard_attach_file { + {-message_id:required} + {-file_id ""} + {-short_filename:required} + {-local_filename:required} + {-mime_type:required} + {-title ""} + {-user_id ""} + {-creation_ip ""} +} { + Creates a new bboard attachment. +} { + db_exec_plsql insert_file { + begin + :1 := acs_message.new_file ( + message_id => :message_id, + file_id => :file_id, + file_name => :short_filename, + title => :title, + mime_type => :mime_type, + content => empty_blob(), + creation_user => :user_id, + creation_ip => :creation_ip, + is_live => 't' + ); + end; + } + + db_1row get_revision { + select content_item.get_latest_revision(:file_id) as revision_id + from dual + } + + set filename [cr_create_content_file $file_id $revision_id $local_filename] + set file_size [file size $local_filename] + + db_dml set_content_size "" +} + + +ad_proc -public bboard_delete_attachment { + {file_id} +} { + Deletes an attachment. +} { + if [db_0or1row is_file_image { + select image_id + from images + where image_id = content_item.get_latest_revision(:file_id) + }] { + db_exec_plsql delete_image { + begin + acs_message.delete_image(:file_id); + end; + } + } else { + db_exec_plsql delete_file { + begin + acs_message.delete_file(:file_id); + end; + } + } +} + +ad_proc -public bboard_alert_from_address { +} { + Returns an appropriate from address for bboard alerts. +} { + return "bboard-robot@[ad_conn host]" +} + +ad_proc -public bboard_alert_message { + {-mime_type:required} + {-content:required} + {-message_id:required} + {-forum_id:required} + {-sender:required} +} { + Takes a bboard message and returns a text message +} { + db_1row forum_info { + select short_name as forum_name + from bboard_forums + where forum_id = :forum_id + } + + if {[string equal $mime_type "text/plain"]} { + set result $content + } elseif {[string equal $mime_type "text/plain; format=flowed"]} { + set result [wrap_string $content] + } elseif {[string equal $mime_type "text/html"]} { + set result [ad_html_to_text $content] + } else { + set result "Error display bboard posting as email! +Our bboard system has received a post we don't know how to +send via email. Please go to the below URL for a better shot +at displaying." + } + + set header "Posted by: $sender" + + set footer "-------------------- +This is a posting from the $forum_name bboard. +To reply you can go to: +[bboard_message_url -absolute $message_id $forum_id] +To unsubscribe from this or other bboard posts go to: +[bboard_subscriptions_url]" + + return "${header} + +${result} + +${footer}" +} + +ad_proc -public bboard_alert_one_mesg { + {-message_id:required} + {-forum_id:required} + {-user_id:required} + {-creation_ip ""} +} { + This proc does generates the appropriate alerts for a new bboard post. + + This proc must be called from within a live page since it depends on + ad_conn being around. +} { + db_1row bboard_mesg_info { + select reply_to, sender, title, mime_type, content, email, + first_names||' '||last_name as full_name + from acs_messages_all, persons, parties + where message_id = :message_id + and person_id = sender + and party_id = person_id + } + + db_1row forum_info { + select short_name as forum_name + from bboard_forums + where forum_id = :forum_id + } + + set email_mesg_id [bboard_message_new -sender $user_id \ + -title "$title \[$forum_name\]" \ + -mime_type "text/plain" \ + -content [bboard_alert_message -mime_type $mime_type \ + -content $content \ + -sender "$full_name <$email>" \ + -message_id $message_id \ + -forum_id $forum_id] \ + -context_id $message_id -creation_user $user_id \ + -creation_ip $creation_ip] + + bboard_schedule_sends -message_id $message_id \ + -email_message_id $email_mesg_id +} + +ad_proc -private bboard_garbage_collect { +} { + garbage collects deleted messages, message email artifacts, etc., + + In particular, this deletes message objects that aren't currently + in a forum, but that are children of bboard messages or bboard forums. + + DRB: The bboard package duplicates messages when you choose to mail one + to a friend, setting the new message's context_id to the original message. + This new message doesn't belong to a forum. The context_id is used to + retrieve these via CONNECT BY and they're then deleted (presumably under + the assumption that they've been e-mailed immediately). + + This is context_id abuse. Context_id is supposed to be used for + permissions inheritance only. This is one of several instances in the + toolkit where context_id is used to link objects together in a hierarchy + in a way that has nothing to do with permissions. It sucks and must be + fixed later (along with a bunch of other crap in this relatively ugly + package). + + I don't think orphans arise in other circumstances but I could be wrong + as I've not scoured the code thoroughly yet. + +} { + acs_messaging_process_queue + + if {[db_type] == "postgresql"} { + bboard_garbage_collect_postgresql + } else { + db_exec_plsql bboard_alert_clean "" + } +} + + +ad_proc -private bboard_garbage_collect_postgresql {} { + Works around postgresql bugs that make it impossible + to delete multiple items in a single transaction + + DRB fixed the assumption that only general-comments and bboard use acs_messaging + +} { + db_foreach get_orphans { + select object_id as message_id + from acs_objects o + where o.object_type = 'bboard_message' + and not exists (select 1 + from bboard_forum_message_map bfmm, acs_objects o2 + where o2.object_id = bfmm.message_id and + o.tree_sortkey between o2.tree_sortkey and tree_right(o2.tree_sortkey)) + } { + db_dml clear_revision_references { + update cr_items + set latest_revision=null, live_revision=null + where item_id = :message_id + } + + db_exec_plsql delete_message { + select bboard_message__remove(:message_id); + } + } +} Index: openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,200 @@ + + + + + + + select * from bboard_forums where forum_id = :forum_id + + + + + + + + + select * from bboard_categories where category_id = :category_id + + + + + + + + + select live_revision as revision_id + from cr_items + where item_id = :message_id + for update + + + + + + + + + select live_revision as revision_id from cr_items + where item_id = :message_id + for update + + + + + + + + + select * from acs_messages_all where message_id = :message_id + + + + + + + + + delete from bboard_forum_subscribers + where forum_id = :forum_id + and subscriber_id = :subscriber_id + + + + + + + + + delete from bboard_category_subscribers + where category_id = :category_id + and subscriber_id = :subscriber_id + + + + + + + + + delete from bboard_thread_subscribers + where thread_id = :thread_id + and subscriber_id = :subscriber_id + + + + + + + + + select count(*) as subscribed_p from bboard_category_subscribers + where category_id = :category_id + and subscriber_id = :user_id + + + + + + + + + select count(*) as subscribed_p from bboard_forum_subscribers + where subscriber_id = :user_id + and forum_id in (select bc.forum_id + from bboard_categories bc + where bc.category_id = + :category_id) + + + + + + + + + select count(*) as subscribed_p + from bboard_forum_subscribers + where forum_id = :forum_id + and subscriber_id = :user_id + + + + + + + + + select count(*) as subscribed_p + from bboard_category_subscribers + where subscriber_id = :user_id + and category_id in (select bcmm.category_id + from bboard_category_message_map bcmm + where bcmm.message_id = :message_id) + + + + + + + + + + select count(*) as subscribed_p + from bboard_forum_subscribers + where subscriber_id = :user_id + and forum_id in (select bfmm.forum_id + from bboard_forum_message_map bfmm + where bfmm.message_id = :message_id) + + + + + + + + + select moderated_p + from bboard_forums + where forum_id = :forum_id + + + + + + + + + select short_name as forum_name + from bboard_forums + where forum_id = :forum_id + + + + + + + + + select reply_to, sender, title, mime_type, content, email, + first_names||' '||last_name as full_name + from acs_messages_all, persons, parties + where message_id = :message_id + and person_id = sender + and party_id = person_id + + + + + + + + + select short_name as forum_name + from bboard_forums + where forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/attachment-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/attachment-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/attachment-delete.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,16 @@ +ad_page_contract { + Delete an attachment. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-date 2000-12-30 + @cvs-id $Id: attachment-delete.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ +} { + file_id:integer,notnull + message_id:integer,notnull +} + +ad_require_permission $file_id bboard_write_message + +bboard_delete_attachment $file_id + +ad_returnredirect [bboard_message_url $message_id] \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/attachment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/attachment.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/attachment.tcl 28 Aug 2003 09:41:47 -0000 1.5 @@ -0,0 +1,16 @@ +ad_page_contract { + This serves an attachment file. + + @author Anukul Kapoor + @creation-date 2000-12-30 + @cvs-id $Id: attachment.tcl,v 1.5 2003/08/28 09:41:47 lars Exp $ +} { + file_id:integer,notnull +} + +if [string equal [ad_parameter "AttachmentsEnabledP"] "t"] { + ad_require_permission $file_id bboard_read_forum + cr_write_content -item_id $file_id +} else { + ad_return_complaint 1 "Attachments are currently disabled" +} Index: openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2-oracle.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,17 @@ + + + + oracle8.1.6 + + + + + begin + bboard_category.delete (:category_id); + end; + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2-postgresql.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,13 @@ + + + + postgresql7.1 + + + + select bboard_category__delete (:category_id); + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,25 @@ +ad_page_contract { + + Delete a category + + @author John Prevost + @creation-date 2000-12-01 + @cvs-id $Id: category-delete-2.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ + +} { + category_id:integer,notnull,bboard_category_id +} + +ad_require_permission $category_id bboard_delete_category + +db_1row forum_id { + select forum_id from bboard_categories where category_id = :category_id +} + +db_exec_plsql delete_category { + begin + bboard_category.delete (:category_id); + end; +} + +ad_returnredirect "forum?forum_id=$forum_id" \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-delete-2.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,13 @@ + + + + + + + select forum_id from bboard_categories where category_id = :category_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/category-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-delete.adp 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,13 @@ + +@context@ +Delete a Category + +You are going to delete the category "@category_name@", causing all +@message_count@ messages in it to be placed in the category "Unknown". + +
+

Are you sure you want to delete this category?

+ +Yes     +No +

Index: openacs-4/contrib/obsolete-packages/bboard/www/category-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-delete.tcl 28 Aug 2003 09:41:47 -0000 1.5 @@ -0,0 +1,40 @@ +ad_page_contract { + + Displays a confirmation of "do you really want to delete this category?" + + @author John Prevost + @creation-date 2000-12-01 + @cvs-id $Id: category-delete.tcl,v 1.5 2003/08/28 09:41:47 lars Exp $ + +} { + category_id:integer,notnull,bboard_category_id +} -properties { + context:onevalue + category_id:onevalue + category_name:onevalue + message_count:onevalue +} + +ad_require_permission $category_id bboard_delete_category + +db_1row forum_short_name_id { + select f.short_name as forum_name, f.forum_id + from bboard_forums f, bboard_categories c + where c.category_id = :category_id + and c.forum_id = f.forum_id +} + +db_1row category_short_name { + select short_name as category_name + from bboard_categories + where category_id = :category_id +} + +db_1row category_message_count { + select count(*) as message_count + from bboard_category_message_map + where category_id = :category_id +} + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + "Delete Category"] Index: openacs-4/contrib/obsolete-packages/bboard/www/category-delete.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-delete.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-delete.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,38 @@ + + + + + + + select f.short_name as forum_name, f.forum_id + from bboard_forums f, bboard_categories c + where c.category_id = :category_id + and c.forum_id = f.forum_id + + + + + + + + + select short_name as category_name + from bboard_categories + where category_id = :category_id + + + + + + + + + select count(*) as message_count + from bboard_category_message_map + where category_id = :category_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/category-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-edit-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-edit-2.tcl 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,26 @@ +ad_page_contract { + + Edit a category + + @author John Prevost + @creation-date 2000-09-07 + @cvs-id $Id: category-edit-2.tcl,v 1.3 2003/08/28 09:41:47 lars Exp $ + + @param category_id The ID of the category to update + @param short_name The short name of the forum + @param forum_id The forum ID the category is in (to redirect back to) + +} { + category_id:integer,notnull,bboard_category_id + short_name:notnull,trim + forum_id:integer,notnull,bboard_forum_id +} + +ad_require_permission $category_id bboard_write_category + +db_transaction { + bboard_category_set -category_id $category_id -short_name $short_name +} +# on error ... + +ad_returnredirect "forum?[export_url_vars forum_id]" Index: openacs-4/contrib/obsolete-packages/bboard/www/category-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-edit.tcl 28 Aug 2003 09:41:47 -0000 1.5 @@ -0,0 +1,43 @@ +ad_page_contract { + + Displays a form for editing a category in a forum. + + @author John Prevost + @creation-date 2000-09-07 + @cvs-id $Id: category-edit.tcl,v 1.5 2003/08/28 09:41:47 lars Exp $ + +} { + category_id:integer,notnull,bboard_category_id +} -properties { + context:onevalue + forum_name:onevalue + forum_id:onevalue + category_id:onevalue + action:onevalue + title:onevalue +} + +ad_require_permission $category_id bboard_write_category + +set action "category-edit-2" +set submit_label "Save Changes" +set title "Edit a Category" + +# bboard_category_get -category_id $category_id -column_array category +# bboard_forum_get -forum_id $category(forum_id) -column_array forum + +# set forum_name $forum(short_name) +# set forum_id $forum(forum_id) +# set short_name $category(short_name) + +db_1row category_info { + select f.short_name as forum_name, f.forum_id, c.short_name + from bboard_forums f, bboard_categories c + where c.category_id = :category_id + and f.forum_id = c.forum_id +} + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + "Edit a Category"] + +ad_return_template category-entry Index: openacs-4/contrib/obsolete-packages/bboard/www/category-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-edit.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-edit.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,16 @@ + + + + + + + select f.short_name as forum_name, f.forum_id, c.short_name + from bboard_forums f, bboard_categories c + where c.category_id = :category_id + and f.forum_id = c.forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/category-entry.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-entry.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-entry.adp 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,21 @@ + +@forum_name@: @title@ +@context@ +category.short_name + +
+ + +
+ + + + + + + + +
Short Name:
+
+
+ Index: openacs-4/contrib/obsolete-packages/bboard/www/category-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-new-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-new-2.tcl 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,26 @@ +ad_page_contract { + + Create a new category in a forum. + + @author John Prevost + @creation-date 2000-08-30 + @cvs-id $Id: category-new-2.tcl,v 1.3 2003/08/28 09:41:47 lars Exp $ + + @param category_id The ID of the new category to be created (debounce) + @param forum_id The ID of the forum to create it in + @param short_name The short name of the forum +} { + category_id:integer,notnull + forum_id:integer,notnull,bboard_forum_id + short_name:notnull,trim +} + +ad_require_permission $forum_id bboard_create_category + +db_transaction { + bboard_category_new -category_id $category_id -forum_id $forum_id \ + -short_name $short_name +} +# on error ... + +ad_returnredirect "forum?[export_url_vars forum_id]" Index: openacs-4/contrib/obsolete-packages/bboard/www/category-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-new.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-new.tcl 28 Aug 2003 09:41:47 -0000 1.5 @@ -0,0 +1,38 @@ +ad_page_contract { + + Displays a form for creating a category in a forum. + + @author John Prevost + @creation-date 2000-08-31 + @cvs-id $Id: category-new.tcl,v 1.5 2003/08/28 09:41:47 lars Exp $ +} { + forum_id:integer,notnull,bboard_forum_id +} -properties { + context:onevalue + forum_name:onevalue + forum_id:onevalue + short_name:onevalue + submit_label:onevalue + category_id:onevalue + action:onevalue + title:onevalue +} + +ad_require_permission $forum_id bboard_create_category + +set action "category-new-2" +set short_name "" +set submit_label "Create Category" +set title "Create a Category" + +db_1row forum_short_name { + select short_name as forum_name from bboard_forums + where forum_id = :forum_id +} + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + "Create a Category"] + +set category_id [db_nextval acs_object_id_seq] + +ad_return_template category-entry Index: openacs-4/contrib/obsolete-packages/bboard/www/category-new.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-new.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-new.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,14 @@ + + + + + + + select short_name as forum_name from bboard_forums + where forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/category-subscribe.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-subscribe.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-subscribe.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,27 @@ +ad_page_contract { + + Unsubscribe the current user from a given category. + + @author John Prevost + @creation-date 2000-10-28 + @cvs-id $Id: category-subscribe.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ + +} { + category_id:integer,notnull,bboard_category_id +} + +db_1row category_forum { + select forum_id from bboard_categories where category_id = :category_id +} + +# Not strictly right +ad_require_permission $forum_id bboard_create_message + +catch { + bboard_subscribe_category \ + -category_id $category_id -subscriber_id [ad_verify_and_get_user_id] +} + +ad_returnredirect "forum-by-category?forum_id=$forum_id&category_id=$category_id" + + Index: openacs-4/contrib/obsolete-packages/bboard/www/category-subscribe.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-subscribe.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-subscribe.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,13 @@ + + + + + + + select forum_id from bboard_categories where category_id = :category_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/category-unsubscribe.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/category-unsubscribe.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/category-unsubscribe.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,27 @@ +ad_page_contract { + + Unsubscribe the current user from a given category. + + @author John Prevost + @creation-date 2000-10-28 + @cvs-id $Id: category-unsubscribe.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ + +} { + forum_id:integer,notnull + category_id:integer,notnull,bboard_category_id + {sub_page ""} +} + +# Not strictly right +ad_require_permission $forum_id bboard_create_message + +catch { + bboard_unsubscribe_category \ + -category_id $category_id -subscriber_id [ad_verify_and_get_user_id] +} + +if [empty_string_p $sub_page] { + ad_returnredirect "forum-by-category?category_id=$category_id&forum_id=$forum_id" +} else { + ad_returnredirect "subscriptions" +} Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category-oracle.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,51 @@ + + + + oracle8.1.6 + + + + + select 1 from dual where 0 = 1 + + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name, + to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated + from bboard_messages_by_category b, persons + where person_id = sender + and reply_to is null + and forum_id = :forum_id + $category_sql + $moderated_sql + order by sent_date desc + + + + + + + + + select 1 from dual where 1 = 0 + + + + + + + + + select 1 from dual where 1 = 0 + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category-postgresql.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,51 @@ + + + + postgresql7.1 + + + + + select 1 where 0 = 1 + + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name, + to_char(last_reply_date,'MM/DD/YY hh12:MI am') as last_updated + from bboard_messages_by_category b, persons + where person_id = sender + and reply_to is null + and forum_id = :forum_id + $category_sql + $moderated_sql + order by sent_date desc + + + + + + + + + select 1 where 1 = 0 + + + + + + + + + select 1 where 1 = 0 + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,144 @@ +ad_page_contract { + + Displays a list of messages in a forum + + @author John Prevost (jmp@arsdigita.com) + @creation-date 2000-08-29 + @cvs-id $Id: forum-by-category.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ +} { + category_id:integer,bboard_category_id + forum_id:integer,notnull,bboard_forum_id +} -properties { + forum_write_p:onevalue + forum_create_p:onevalue + context:onevalue + title:onevalue + forum_name:onevalue + forum_id:onevalue + category_id:onevalue + messages:multirow + categories:multirow + moderator_p:onevalue + unapproved:multirow + rejected:multirow + subscribed_p:onevalue +} + +ad_require_permission $forum_id bboard_read_forum + +set moderator_p 0 + +set category_create_p 0 + +set user_id [ad_verify_and_get_user_id] + +set subscribed_p 0 + +set admin_p [ad_permission_p $forum_id admin] + +db_1row forum_info { + select f.short_name as forum_name, f.moderated_p + from bboard_forums f + where f.forum_id = :forum_id +} + + +if ![string eq $category_id ""] { + db_1row forum_info { + select f.forum_id, f.short_name as forum_name, f.moderated_p + from bboard_categories c, bboard_forums f + where c.category_id = :category_id + and c.forum_id = f.forum_id + } + + if [string equal $moderated_p "t"] { + set moderator_p [ad_permission_p $forum_id bboard_moderate_forum] + } + + db_1row category_info { + select short_name as category_name from bboard_categories + where category_id = :category_id + } + +} else { + set category_name "Uncategorized" +} + + +if { ![string eq $category_id ""] && [string equal [bboard_category_subscribed_p -direct $user_id $category_id] "t"]} { + set subscribed_p 1 +} else { + set subscribed_p 0 +} + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + $category_name] +set title "$forum_name: $category_name" + +set package_id [ad_conn package_id] + +db_multirow categories categories_select_none { + select 1 from dual where 0 = 1 +} + +if [string equal $moderated_p "f"] { + set moderated_sql "" +} else { + set moderated_sql "and status = 'approved'" +} + +if {[string eq $category_id ""]} { + set category_sql "and category_id is null" +} else { + set category_sql "and category_id = :category_id" +} + + +db_multirow messages messages_select_by_cat " + select message_id, title, num_replies, + first_names||' '||last_name as full_name, + to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated + from bboard_messages_by_category b, persons + where person_id = sender + and reply_to is null + and forum_id = :forum_id + $category_sql + $moderated_sql + order by sent_date desc + " + +if { !$moderator_p } { + + db_multirow unapproved unapproved_none { + select 1 from dual where 1 = 0 + } + + db_multirow rejected rejected_none { + select 1 from dual where 1 = 0 + } + +} else { + + db_multirow unapproved messages_select_unmoderated { + select message_id, title, num_replies, + first_names||' '||last_name as full_name + from bboard_messages_by_category, persons + where category_id = :category_id + and person_id = sender + and reply_to is null + and status = 'unmoderated' + } + + db_multirow rejected rejected_messages_select { + select message_id, title, num_replies, + first_names||' '||last_name as full_name + from bboard_messages_by_category, persons + where category_id = :category_id + and person_id = sender + and reply_to is null + and status = 'rejected' + } + +} + +ad_return_template "forum-view" Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-by-category.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,65 @@ + + + + + + + select f.short_name as forum_name, f.moderated_p + from bboard_forums f + where f.forum_id = :forum_id + + + + + + + + + select f.forum_id, f.short_name as forum_name, f.moderated_p + from bboard_categories c, bboard_forums f + where c.category_id = :category_id + and c.forum_id = f.forum_id + + + + + + + + select short_name as category_name from bboard_categories + where category_id = :category_id + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name + from bboard_messages_by_category, persons + where category_id = :category_id + and person_id = sender + and reply_to is null + and status = 'unmoderated' + + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name + from bboard_messages_by_category, persons + where category_id = :category_id + and person_id = sender + and reply_to is null + and status = 'rejected' + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2-oracle.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,39 @@ + + + + oracle8.1.6 + + + + + declare + cursor category_cursor is + select distinct category_id + from bboard_categories c + where c.forum_id = :forum_id; + begin + for category_val in category_cursor loop + + delete from acs_permissions + where object_id = category_val.category_id; + + bboard_category.delete(category_val.category_id); + end loop; + end; + + + + + + + + + begin + bboard_forum.delete (:forum_id); + end; + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2-postgresql.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,34 @@ + + + + postgresql7.1 + + + + declare + category_val record; + begin + for category_val in select distinct category_id + from bboard_categories c + where c.forum_id = :forum_id + loop + + delete from acs_permissions + where object_id = category_val.category_id; + + perform bboard_category__delete(category_val.category_id); + end loop; + return 0; + end; + + + + + + + select bboard_forum__delete (:forum_id); + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,37 @@ +ad_page_contract { + Presents confirmation screen for deleting a forum. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-date 2000-30-11 + @cvs-id $Id: forum-delete-2.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ +} { + forum_id:integer,notnull,bboard_forum_id +} -properties { + forum_id:onevalue + short_name:onevalue + charter:onevalue +} + +set user_id [ad_verify_and_get_user_id] + +ad_require_permission $forum_id admin + +# postgresql can't do all this in a transaction + +if {[db_type] == "postgresql"} { + db_dml messages_delete "" + bboard_garbage_collect + db_exec_plsql categories_delete "" + db_dml permissions_delete "" + db_exec_plsql forum_delete "" +} else { + db_transaction { + db_dml messages_delete "" + bboard_garbage_collect + db_exec_plsql categories_delete "" + db_dml permissions_delete "" + db_exec_plsql forum_delete "" + } +} + +ad_returnredirect "" Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-delete-2.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,25 @@ + + + + + + + delete from bboard_forum_message_map + where forum_id = :forum_id + + + + + + + + + + delete from acs_permissions + where object_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-delete.adp 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,14 @@ + +@context@ +@forum_name@ + +

Delete @forum_name@ forum?

+ +You have chosen to delete the @forum_name@ forum.

This forum and its +messages (@message_count@) will be irrevocably deleted.

+ +

+ + +
+ Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-delete.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,34 @@ +ad_page_contract { + Presents confirmation screen for deleting a forum. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-date 2000-30-11 + @cvs-id $Id: forum-delete.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ +} { + forum_id:integer,notnull,bboard_forum_id +} -properties { + forum_id:onevalue + short_name:onevalue + charter:onevalue +} + +set package_id [ad_conn package_id] + +set context [list "Delete a forum"] +set user_id [ad_verify_and_get_user_id] + +ad_require_permission $forum_id admin + +db_1row forum_info { + select short_name as forum_name, charter as forum_charter + from bboard_forums + where forum_id = :forum_id +} + +db_1row forum_message_count { + select count(*) as message_count + from bboard_forum_message_map bfmm + where bfmm.forum_id = :forum_id +} + +ad_return_template \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-delete.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-delete.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-delete.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,26 @@ + + + + + + + select short_name as forum_name, charter as forum_charter + from bboard_forums + where forum_id = :forum_id + + + + + + + + + select count(*) as message_count + from bboard_forum_message_map bfmm + where bfmm.forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-edit-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-edit-2.tcl 28 Aug 2003 09:41:47 -0000 1.5 @@ -0,0 +1,36 @@ +ad_page_contract { + + Save changes to a forum. + + @author John Prevost + @creation-date 2000-09-07 + @cvs-id $Id: forum-edit-2.tcl,v 1.5 2003/08/28 09:41:47 lars Exp $ + + @param forum_id The ID of the forum to be changed + @param short_name The short name of the forum + @param charter The long description (charter) of the forum + @param moderated_p Should the forum be moderated? +} { + forum_id:integer,notnull,bboard_forum_id + short_name:notnull,trim + charter:trim + {moderated_p:optional ""} +} + +ad_require_permission $forum_id admin + +if [empty_string_p $moderated_p] { + set moderated_p "f" +} else { + set moderated_p "t" +} + +set package_id [ad_conn package_id] + +db_transaction { + bboard_forum_set -forum_id $forum_id -short_name $short_name \ + -charter $charter -moderated_p $moderated_p +} +# on error ... + +ad_returnredirect "." Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-edit.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,34 @@ +ad_page_contract { + + Displays a form for editing a forum. + + @author John Prevost (jmp@arsdigita.com) + @creation-date 2000-09-07 + @cvs-id $Id: forum-edit.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ + +} { + forum_id:integer,notnull,bboard_forum_id +} -properties { + context:onevalue + forum_id:onevalue + title:onevalue + action:onevalue + submit_label:onevalue + short_name:onevalue + charter:onevalue + moderated_p:onevalue +} + +ad_require_permission $forum_id admin + +db_1row forum_info { + select short_name, charter, moderated_p from bboard_forums + where forum_id = :forum_id +} + +set context [list "Edit a Forum"] +set title "Edit a Forum" +set action "forum-edit-2" +set submit_label "Save Changes" + +ad_return_template "forum-entry" Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-edit.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-edit.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,14 @@ + + + + + + + select short_name, charter, moderated_p from bboard_forums + where forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-entry.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-entry.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-entry.adp 28 Aug 2003 09:41:47 -0000 1.7 @@ -0,0 +1,32 @@ + +@context@ +@title@ +forum.short_name + +
+ +
+ + + + + + + + + + + + + + + + + + +
Short Name:

Charter (optional): +
Moderated: + +
+
+
Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-move-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-move-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-move-2.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,41 @@ +ad_page_contract { + + Move a forum's messages to another forum. + + @author Anukul Kapoor + @creation-date 2001-04-12 + @cvs-id $Id: forum-move-2.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ + +} { + forum_id:integer,notnull,bboard_forum_id + dest_forum_id:integer,notnull,bboard_forum_id +} + +ad_require_permission $forum_id admin +ad_require_permission $dest_forum_id admin + +set user_id [ad_conn user_id] + +db_transaction { + db_dml update_bboard_contexts { + update acs_objects + set context_id = :dest_forum_id + where context_id = :forum_id + and (object_type = 'bboard_message' or + object_type = 'bboard_category') + } + + db_dml move_bboard_messages { + update bboard_forum_message_map + set forum_id = :dest_forum_id + where forum_id = :forum_id + } + + db_dml move_bboard_categories { + update bboard_categories + set forum_id = :dest_forum_id + where forum_id = :forum_id + } +} + +ad_returnredirect "forum?forum_id=$forum_id" Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-move-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-move-2.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-move-2.xql 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,39 @@ + + + + + + + update acs_objects + set context_id = :dest_forum_id + where context_id = :forum_id + and (object_type = 'bboard_message' or + object_type = 'bboard_category') + + + + + + + + + update bboard_forum_message_map + set forum_id = :dest_forum_id + where forum_id = :forum_id + + + + + + + + + update bboard_categories + set forum_id = :dest_forum_id + where forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-move.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-move.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-move.adp 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,28 @@ + +Move a forum's messages +Move + +
+ @form_data@ + +
+ + + + +
Forum:@forum_name@
Charter: + @charter@
+

+ +Move to this forum's messages to: forum? +
+This will move all of this forum's messages and categories and is not easily undoable. + + +

+
+
Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-move.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-move.tcl 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,40 @@ +ad_page_contract { + + Confirmation screem for moving a forum's messages to another forum. + + @author Anukul Kapoor + @creation-date 2001-04-12 + @cvs-id $Id: forum-move.tcl,v 1.3 2003/08/28 09:41:47 lars Exp $ + +} { + forum_id:integer,notnull,bboard_forum_id +} -properties { + forum_id:onevalue + forum_name:onevalue + charter:onevalue + forums:multirow +} + +ad_require_permission $forum_id admin + +set user_id [ad_conn user_id] + +db_1row forum_info { + select short_name as forum_name, charter, moderated_p from bboard_forums + where forum_id = :forum_id +} + +db_multirow forums allowed_target_forums { + select forum_id, short_name + from bboard_forums + where not forum_id = :forum_id + and exists (select 1 from acs_object_party_privilege_map + where object_id = forum_id + and party_id in (:user_id, -1) + and privilege = 'admin') + +} + +set form_data [export_form_vars forum_id] + +ad_return_template Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-move.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-move.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-move.xql 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,30 @@ + + + + + + + select short_name as forum_name, charter, moderated_p from bboard_forums + where forum_id = :forum_id + + + + + + + + + select forum_id, short_name + from bboard_forums + where not forum_id = :forum_id + and exists (select 1 from all_object_party_privilege_map + where object_id = forum_id + and party_id in (:user_id, -1) + and privilege = 'admin') + + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-new-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-new-2.tcl 28 Aug 2003 09:41:47 -0000 1.5 @@ -0,0 +1,38 @@ +ad_page_contract { + + Create a new forum. + + @author John Prevost + @creation-date 2000-08-30 + @cvs-id $Id: forum-new-2.tcl,v 1.5 2003/08/28 09:41:47 lars Exp $ + + @param forum_id The ID of the new forum to be created (debounce) + @param short_name The short name of the forum + @param charter The long description (charter) of the forum + @param moderated_p Should the forum be moderated? +} { + forum_id:integer,notnull + short_name:notnull,trim + charter:trim + {moderated_p:optional ""} +} + +ad_require_permission [ad_conn package_id] admin + +if [empty_string_p $moderated_p] { + set moderated_p "f" +} else { + set moderated_p "t" +} + +set package_id [ad_conn package_id] + +db_transaction { + bboard_forum_new -forum_id $forum_id -short_name $short_name \ + -charter $charter -moderated_p $moderated_p \ + -bboard_id $package_id -creation_user [ad_verify_and_get_user_id] \ + -creation_ip [ad_conn peeraddr] -context_id $package_id +} +# on error ... + +ad_returnredirect "." Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-new.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-new.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,31 @@ +ad_page_contract { + + Displays a form for creating a new forum. + + @author John Prevost (jmp@arsdigita.com) + @creation-date 2000-08-29 + @cvs-id $Id: forum-new.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ +} { +} -properties { + context:onevalue + forum_id:onevalue + title:onevalue + action:onevalue + submit_label:onevalue + short_name:onevalue + charter:onevalue +} + +ad_require_permission [ad_conn package_id] admin + +set context [list "Create a Forum"] +set title "Create a Forum" +set action "forum-new-2" +set submit_label "Create Forum" +set short_name "" +set charter "" +set moderated_p "f" + +set forum_id [db_nextval acs_object_id_seq] + +ad_return_template "forum-entry" Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-oracle.xql 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,120 @@ + + + + oracle8.1.6 + + + + + select short_name as forum_name, moderated_p, + acs_permission.permission_p(:forum_id, :user_id, 'admin') as admin_p, + acs_permission.permission_p(:forum_id, :user_id, 'bboard_create_category') + as category_create_p + from bboard_forums + where forum_id = :forum_id + + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name, + to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated + from bboard_messages_all b, persons + where forum_id = :forum_id + and sent_date > case when :last_n_days = 0 then '1976-01-01' else to_char(sysdate - :last_n_days) end + and person_id = sender + and reply_to is null + order by sent_date desc + + + + + + + + + select c.category_id, c.short_name, + count(m.message_id) as message_count + from bboard_categories c, + (select c.category_id, c.message_id + from bboard_category_message_map c, + bboard_forum_message_map f + where c.message_id = f.message_id + and f.forum_id = :forum_id) m + where c.forum_id = :forum_id + and m.category_id(+) = c.category_id + and (m.message_id is null + or m.message_id in (select f.message_id + from bboard_forum_message_map f + where f.forum_id = :forum_id)) + group by c.category_id, short_name + + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name, + to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated + from bboard_messages_all b, persons + where forum_id = :forum_id + and sent_date > case when :last_n_days = 0 then '1976-01-01' else to_char(sysdate - :last_n_days) end + and person_id = sender + and reply_to is null + and status = 'approved' + order by sent_date desc + + + + + + + + + select c.category_id, c.short_name, + count(m.message_id) as message_count + from bboard_categories c, + (select c.category_id, c.message_id + from bboard_category_message_map c, + bboard_forum_message_map f + where c.message_id = f.message_id + and f.status = 'approved' + and f.forum_id = :forum_id) m + where c.forum_id = :forum_id + and m.category_id(+) = c.category_id + and (m.message_id is null + or m.message_id in (select f.message_id + from bboard_forum_message_map f + where f.forum_id = :forum_id)) + group by c.category_id, short_name + + + + + + + + + select 1 from dual where 1 = 0 + + + + + + + + + select 1 from dual where 1 = 0 + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-postgresql.xql 28 Aug 2003 09:41:47 -0000 1.5 @@ -0,0 +1,110 @@ + + + + postgresql7.1 + + + + + select short_name as forum_name, moderated_p, + acs_permission__permission_p(:forum_id, :user_id, 'admin') as admin_p, + acs_permission__permission_p(:forum_id, :user_id, 'bboard_create_category') + as category_create_p + from bboard_forums + where forum_id = :forum_id + + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name, + to_char(last_reply_date,'MM/DD/YY hh12:MI am') as last_updated + from bboard_messages_all b, persons + where forum_id = :forum_id + and age(sent_date) < case when :last_n_days = 0 + then interval '99 years' + else interval '$last_n_days days' + end + and person_id = sender + and reply_to is null + order by sent_date desc + + + + + + + + + select short_name, count(message_id) as message_count, category_id + from bboard_forum_message_map f join + (bboard_categories c left outer join bboard_category_message_map m using (category_id)) + using (message_id) + where f.forum_id = :forum_id + group by category_id, short_name + order by category_id; + + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name, + to_char(last_reply_date,'MM/DD/YY hh12:MI am') as last_updated + from bboard_messages_all b, persons + where forum_id = :forum_id + and age(sent_date) < case when :last_n_days = 0 + then interval '99 years' + else interval '$last_n_days days' + end + and person_id = sender + and reply_to is null + and status = 'approved' + order by sent_date desc + + + + + + + + + select short_name, count(message_id) as message_count, category_id + from bboard_forum_message_map f join + (bboard_categories c left outer join bboard_category_message_map m using (category_id)) + using (message_id) + where f.forum_id = :forum_id + and f.status = 'approved' + group by category_id, short_name + order by category_id; + + + + + + + + + select 1 where 1 = 0 + + + + + + + + + select 1 where 1 = 0 + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-subscribe.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-subscribe.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-subscribe.tcl 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,21 @@ +ad_page_contract { + + Subscribe the current user to a given forum. + + @author John Prevost + @creation-date 2000-10-28 + @cvs-id $Id: forum-subscribe.tcl,v 1.3 2003/08/28 09:41:47 lars Exp $ + +} { + forum_id:integer,notnull,bboard_forum_id +} + +# Not strictly right +ad_require_permission $forum_id bboard_create_message + +catch { + bboard_subscribe_forum \ + -forum_id $forum_id -subscriber_id [ad_verify_and_get_user_id] +} + +ad_returnredirect "forum?forum_id=$forum_id" \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-unsubscribe.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-unsubscribe.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-unsubscribe.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,23 @@ +ad_page_contract { + + Unsubscribe the current user from a given forum. + + @author John Prevost + @creation-date 2000-10-28 + @cvs-id $Id: forum-unsubscribe.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ + +} { + forum_id:integer,notnull,bboard_forum_id + {sub_page ""} +} + +catch { + bboard_unsubscribe_forum \ + -forum_id $forum_id -subscriber_id [ad_verify_and_get_user_id] +} + +if [empty_string_p $sub_page] { + ad_returnredirect "forum?forum_id=$forum_id" +} else { + ad_returnredirect "subscriptions" +} Index: openacs-4/contrib/obsolete-packages/bboard/www/forum-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum-view.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum-view.adp 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,110 @@ + +@context@ +@title@ + + + + +
+ + [ Post a message ] + + + [Post a message] + + + + + + + [Subscribe to Category] + + + [Subscribe to Forum] + + + + + You're subscribed to this category [Unsubscribe] + + + You're subscribed to this forum [Unsubscribe] + + +

+ + + +
+

Messages

+ + + Last @last_n_days@ days. Show All Messages.
+ + + +

Not Yet Approved

+ +

Approved

+ + + + + + + +

Rejected

+ +
+
+ + +

By Category

+
+ + + + + + [Create a category] +

+ +

Search

+
+ + + +
+ +

+ + +

Admin

+ [Move messages to other forum] + [Set Permissions] + \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/forum.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,179 @@ +ad_page_contract { + + Displays a list of messages in a forum + + @author John Prevost (jmp@arsdigita.com) + @creation-date 2000-08-29 + @cvs-id $Id: forum.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ +} { + forum_id:integer,notnull + {last_n_days:integer,optional ""} +} -properties { + forum_write_p:onevalue + forum_create_p:onevalue + context:onevalue + title:onevalue + forum_name:onevalue + forum_id:onevalue + messages:multirow + categories:multirow + moderator_p:onevalue + unapproved:multirow + rejected:multirow + subscribed_p:onevalue + last_n_days:onevalue + uncategorized_count:onevalue +} + +set user_id [ad_verify_and_get_user_id] + +ad_require_permission $forum_id bboard_read_forum + +db_1row forum_info { + select short_name as forum_name, moderated_p, + acs_permission.permission_p(:forum_id, :user_id, 'admin') as admin_p, + acs_permission.permission_p(:forum_id, :user_id, 'bboard_create_category') + as category_create_p + from bboard_forums + where forum_id = :forum_id +} + +set moderator_p 0 + +if [string equal $moderated_p "t"] { + set moderator_p [ad_permission_p $forum_id bboard_moderate_forum] +} + + +if [string equal [bboard_forum_subscribed_p $user_id $forum_id] "t"] { + set subscribed_p 1 +} else { + set subscribed_p 0 +} + +if [string equal $last_n_days ""] { + set last_n_days [ad_parameter DisplayLastNDays] + + if [string equal $last_n_days ""] { + set last_n_days "0" + } +} + +set context [list $forum_name] +set title $forum_name + +set package_id [ad_conn package_id] + +if [string equal $moderated_p "f"] { + + db_multirow messages messages_select { + select message_id, title, num_replies, + first_names||' '||last_name as full_name, + to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated + from bboard_messages_all b, persons + where forum_id = :forum_id + and sent_date > decode(:last_n_days, 0, '1976-01-01', sysdate - :last_n_days) + and person_id = sender + and reply_to is null + order by sent_date desc + } + + db_multirow categories categories_select { + select c.category_id, short_name, count(m.message_id) as message_count + from bboard_categories c, + bboard_category_message_map m + where c.forum_id = :forum_id + and m.category_id(+) = c.category_id + and (m.message_id is null + or m.message_id in (select f.message_id + from bboard_forum_message_map f + where f.forum_id = :forum_id)) + group by c.category_id, short_name + } + + db_1row uncategorized_count { + select count(*) as uncategorized_count + from bboard_messages_by_category b + where category_id is null + and forum_id = :forum_id + } + + +} else { + + db_multirow messages messages_select_approved { + select message_id, title, num_replies, + first_names||' '||last_name as full_name, + to_char(last_reply_date,'MM/DD/YY hh12:Mi am') as last_updated + from bboard_messages_all b, persons + where forum_id = :forum_id + and sent_date > decode(:last_n_days, 0, '1976-01-01', sysdate - :last_n_days) + and person_id = sender + and reply_to is null + and status = 'approved' + order by sent_date desc + } + + db_multirow categories categories_select_approved { + select c.category_id, c.short_name, + count(m.message_id) as message_count + from bboard_categories c, + (select c.category_id, c.message_id + from bboard_category_message_map c, + bboard_forum_message_map f + where c.message_id = f.message_id + and f.status = 'approved' + and f.forum_id = :forum_id) m + where c.forum_id = :forum_id + and m.category_id(+) = c.category_id + and (m.message_id is null + or m.message_id in (select f.message_id + from bboard_forum_message_map f + where f.forum_id = :forum_id)) + group by c.category_id, short_name + } + + db_1row uncategorized_approved_count { + select count(*) as uncategorized_count + from bboard_messages_by_category b + where category_id is null + and forum_id = :forum_id + } + +} + +if { !$moderator_p } { + + db_multirow unapproved unapproved_none { + select 1 from dual where 1 = 0 + } + + db_multirow rejected rejected_none { + select 1 from dual where 1 = 0 + } + +} else { + + db_multirow unapproved messages_select_unmoderated { + select message_id, title, num_replies, + first_names||' '||last_name as full_name + from bboard_messages_all, persons + where forum_id = :forum_id + and person_id = sender + and reply_to is null + and status = 'unmoderated' + } + + db_multirow rejected rejected_messages_select { + select message_id, title, num_replies, + first_names||' '||last_name as full_name + from bboard_messages_all, persons + where forum_id = :forum_id + and person_id = sender + and reply_to is null + and status = 'rejected' + } + +} + +ad_return_template "forum-view" Index: openacs-4/contrib/obsolete-packages/bboard/www/forum.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/forum.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/forum.xql 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,63 @@ + + + + + + + select count(*) as uncategorized_count + from bboard_forum_message_map msg + where forum_id = :forum_id + and not exists (select 1 + from bboard_category_message_map cat + where msg.message_id = cat.message_id) + + + + + + + + + select count(*) as uncategorized_count + from bboard_forum_message_map msg + where forum_id = :forum_id + and status = 'approved' + and not exists (select 1 + from bboard_category_message_map cat + where msg.message_id = cat.message_id) + + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name + from bboard_messages_all, persons + where forum_id = :forum_id + and person_id = sender + and reply_to is null + and status = 'unmoderated' + + + + + + + + + select message_id, title, num_replies, + first_names||' '||last_name as full_name + from bboard_messages_all, persons + where forum_id = :forum_id + and person_id = sender + and reply_to is null + and status = 'rejected' + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/index-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/index-oracle.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,19 @@ + + + + oracle8.1.6 + + + + + select forum_id, short_name, moderated_p, charter + from bboard_forums f + where bboard_id = :package_id + and acs_permission.permission_p(forum_id,:user_id,'bboard_read_forum') = 't' + order by short_name + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/index-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/index-postgresql.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,19 @@ + + + + postgresql7.1 + + + + + select forum_id, short_name, moderated_p, charter + from bboard_forums f + where bboard_id = :package_id + and acs_permission__permission_p(forum_id,:user_id,'bboard_read_forum') = 't' + order by short_name + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/index.adp 28 Aug 2003 09:41:47 -0000 1.7 @@ -0,0 +1,39 @@ + +@context@ +Forums + +[Manage Subscriptions] + + +

There are no forums available.

+
+ + + + + +

+ + + [Create a forum] + [Set Parameters] + [Admin Permissions] + +

Index: openacs-4/contrib/obsolete-packages/bboard/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/index.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,32 @@ +ad_page_contract { + + Displays a list of forums on the site + + @author John Prevost (jmp@arsdigita.com) + @creation-date 2000-08-29 + @cvs-id $Id: index.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ +} { +} -properties { + context:onevalue + package_id:onevalue + user_id:onevalue + forums:multirow +} + +set package_id [ad_conn package_id] + +set context [list] + +set user_id [ad_verify_and_get_user_id] + +set admin_p [ad_permission_p $package_id admin] + +db_multirow forums forums_select { + select forum_id, short_name, moderated_p, charter + from bboard_forums f + where bboard_id = :package_id + and acs_permission.permission_p(forum_id,:user_id,'bboard_read_forum') = 't' + order by short_name +} + +ad_return_template Index: openacs-4/contrib/obsolete-packages/bboard/www/message-approve.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-approve.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-approve.tcl 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,27 @@ +ad_page_contract { + + Marks a message as approved for display in a moderated forum. + + @author John Prevost + @creation-date 2000-09-10 + @cvs-id $Id: message-approve.tcl,v 1.3 2003/08/28 09:41:47 lars Exp $ + +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id +} + +ad_require_permission $forum_id bboard_moderate_forum + +bboard_message_set_status -message_id $message_id -forum_id $forum_id \ + -status "approved" + +db_1row sender_info { + select sender from acs_messages where message_id = :message_id +} + +# Should this check if it was already approved? +bboard_alert_one_mesg -message_id $message_id -forum_id $forum_id \ + -user_id $sender -creation_ip [ad_conn peeraddr] + +ad_returnredirect "forum?forum_id=$forum_id" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-approve.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-approve.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-approve.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,13 @@ + + + + + + + select sender from acs_messages where message_id = :message_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-attach-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-attach-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-attach-2.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,68 @@ +ad_page_contract { + + We will do the grunt work here of creating an attachment. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-date 2000-12-18 + @cvs-id $Id: message-attach-2.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ + +} { + message_id:integer,notnull + file_id:integer,notnull + file_title:notnull + upload_file:notnull + upload_file.tmpfile:tmpfile +} + +ad_require_permission $message_id bboard_write_message + +# authenticate the user +set user_id [ad_verify_and_get_user_id] + +# aolserver will give us a guessed mime type for the upload +set guessed_file_type [cr_filename_to_mime_type $upload_file] + +# let us get the useful bits out of the long filename +set full_filename ${upload_file.tmpfile} +set base_filename [bboard_upload_basename $upload_file] +set file_ext [bboard_upload_extension $full_filename] + +# check file size against user parameters + +set n_bytes [file size $full_filename] +set max_file_size [ad_parameter MaxAttachmentSize] + +if { $n_bytes > $max_file_size && $max_file_size > 0 } { + ad_return_complaint 1 "Your file is too large. The publisher of + [ad_system_name] has chosen to limit attachments to + [util_commify_number $max_file_size] bytes.\n" +} +if { $n_bytes == 0 } { + ad_return_complaint 1 "Your file is zero-length. Either you attempted to + upload a zero length file, a file which does not exists, + or something went wrong during the transfer.\n" +} + + +# insert the file into the database + +db_transaction { + if { $file_ext == "jpeg" || $file_ext == "jpg" || $file_ext == "gif" } { + set image_size [bboard_image_size $file_ext $upload_file] + set width [lindex $image_size 0] + set height [lindex $image_size 1] + + bboard_attach_image -message_id $message_id -file_id $file_id \ + -short_filename $base_filename -local_filename $full_filename\ + -mime_type $guessed_file_type -user_id $user_id \ + -creation_ip [ad_conn peeraddr] -title $file_title \ + -width $width -height $height + } else { + bboard_attach_file -message_id $message_id -file_id $file_id \ + -short_filename $base_filename -local_filename $full_filename\ + -mime_type $guessed_file_type -user_id $user_id \ + -creation_ip [ad_conn peeraddr] -title $file_title + } +} + +ad_returnredirect [bboard_message_url $message_id] Index: openacs-4/contrib/obsolete-packages/bboard/www/message-attach.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-attach.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-attach.adp 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,29 @@ + +@title@ +@context@ +attach.file_title + +

+<%= [export_form_vars file_id message_id] %> + +
+ + + + + + + + + +
Title:
Filename: +
+ Use the "Browse..." button to locate your file, then click "Open". +
+
+ +

+

+ +
+
Index: openacs-4/contrib/obsolete-packages/bboard/www/message-attach.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-attach.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-attach.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,27 @@ +ad_page_contract { + + This page presents a form for creating a message attachment. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-datee 2000-12-18 + @cvs-id $Id: message-attach.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ + +} { + forum_id:integer,notnull,bboard_forum_id + message_id:integer,notnull +} -properties { + title:onevalue + context:onevalue + file_id:onevalue + message_id:onevalue + forum_id:onevalue +} + +ad_require_permission $message_id bboard_write_message + +set title "Upload message attachment" +set context [list "Upload an attachment"] + +set file_id [db_nextval acs_object_id_seq] + +ad_return_template \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-oracle.xql 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,24 @@ + + + + oracle8.1.6 + + + + + delete from bboard_forum_message_map bfm + where message_id in (select message_id + from acs_messages m + connect by prior message_id = reply_to + start with message_id = :message_id) + and exists (select 1 from all_object_party_privilege_map + where object_id = bfm.message_id + and party_id in (:user_id, -1) + and privilege = 'bboard_delete_message') + + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2-postgresql.xql 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,24 @@ + + + + postgresql7.1 + + + + + delete from bboard_forum_message_map + where message_id in + (select m.message_id + from acs_messages m, acs_messages m2 + where m2.message_id = :message_id + and m.tree_sortkey between m2.tree_sortkey and tree_right(m2.tree_sortkey)) + and exists (select 1 from all_object_party_privilege_map + where object_id = message_id + and party_id = :user_id + and privilege = 'bboard_delete_message') + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-delete-2.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,41 @@ +ad_page_contract { + + Delete a message + + @author John Prevost + @creation-date 2000-09-06 + @cvs-id $Id: message-delete-2.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ + +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id + {replies ""} +} + +if {[ad_parameter "UserPostsDeletableP"] == "t"} { + ad_require_permission $message_id bboard_write_message +} else { + ad_require_permission $message_id admin +} + +set user_id [ad_verify_and_get_user_id] + +if [string eq $replies ""] { + bboard_message_set_status -message_id $message_id -forum_id $forum_id \ + -status [db_null] +} else { + db_dml bboard_delete_threads { + delete from bboard_forum_message_map bfm + where message_id in (select message_id + from acs_messages m + connect by prior message_id = reply_to + start with message_id = :message_id) + and exists (select 1 from acs_object_party_privilege_map + where object_id = bfm.message_id + and party_id in (:user_id, -1) + and privilege = 'bboard_delete_message') + + } +} + +ad_returnredirect "forum?forum_id=$forum_id" \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/message-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-delete.adp 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,24 @@ + +@context@ +Delete a Message + + + +
+ + +

Are you sure you want to delete this message?

+ +Yes + + +

Are you sure you want to delete this message and all of its replies?

+ +Yes     + +    +No +

Index: openacs-4/contrib/obsolete-packages/bboard/www/message-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-delete.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,49 @@ +ad_page_contract { + + Displays a confirmation of "do you really want to delete this message?" + + @author John Prevost + @creation-date 2000-09-06 + @cvs-id $Id: message-delete.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ + +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id + {replies ""} +} -properties { + context:onevalue + message_id:onevalue + forum_id:onevalue + message:onerow + replies:onevalue +} + +if {[ad_parameter "UserPostsDeletableP"] == "t"} { + ad_require_permission $message_id bboard_write_message +} else { + ad_require_permission $message_id admin +} + +if ![db_0or1row message_info { + select m.message_id, m.reply_to, m.title, + m.sent_date, m.mime_type, m.content, + p.first_names ||' '||p.last_name as full_name + from acs_messages_all m, persons p, bboard_forum_message_map f + where m.message_id = :message_id + and f.message_id = :message_id + and f.forum_id = :forum_id + and p.person_id = m.sender + } -column_array message] { + # It's not in that forum! + ad_returnredirect "forum?forum_id=$forum_id" + ad_script_abort +} + +db_1row forum_short_name { + select short_name as forum_name from bboard_forums + where forum_id = :forum_id +} + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + "Delete Message"] + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-delete.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-delete.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-delete.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,30 @@ + + + + + + + select m.message_id, m.reply_to, m.title, + m.sent_date, m.mime_type, m.content, + p.first_names ||' '||p.last_name as full_name + from acs_messages_all m, persons p, bboard_forum_message_map f + where m.message_id = :message_id + and f.message_id = :message_id + and f.forum_id = :forum_id + and p.person_id = m.sender + + + + + + + + + select short_name as forum_name from bboard_forums + where forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-edit-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-edit-2.tcl 28 Aug 2003 09:41:47 -0000 1.7 @@ -0,0 +1,73 @@ +ad_page_contract { + + Confirmation page for editing a message. + + @author John Prevost + @creation-datee 2000-09-08 + @cvs-id $Id: message-edit-2.tcl,v 1.7 2003/08/28 09:41:47 lars Exp $ + + @param message_id The message to update + @param title The new title + @param content The new content + @param mime_type The new mime type + @param category_id The new category +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id + title:notnull,trim + content:notnull,allhtml,trim + mime_type:notnull + category_id:integer,bboard_category_id +} -validate { + content_html -requires {content mime_type} { + if [string eq $mime_type "text/html"] { + set complaint [ad_check_for_naughty_html $content] + if ![empty_string_p $complaint] { + ad_complain $complaint + return 0 + } + } + return 1 + } +} -properties { + forum_id:onevalue + page_title:onevalue + context:onevalue + forum_name:onevalue + content_for_display:onevalue + title:onevalue + message_id:onevalue + form_vars:onevalue + reply_to:onevalue + target:onevalue + msg_mime_type:onevalue +} + +ad_require_permission $message_id bboard_write_message + +db_1row forum_short_name { + select short_name as forum_name from bboard_forums + where forum_id = :forum_id +} + +set target "message-edit-3" + +set msg_mime_type $mime_type + +db_1row forum_short_name { + select short_name as forum_name from bboard_forums + where forum_id = :forum_id +} + +set page_title "Confirm Message Changes in $forum_name" + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + "Confirm Message Edit"] + +set content_for_display [acs_messaging_format_as_html $mime_type $content] + + +set form_vars [export_form_vars message_id forum_id title content \ + mime_type category_id reply_to] + +ad_return_template "message-preview" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-edit-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-edit-2.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-edit-2.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,24 @@ + + + + + + + select short_name as forum_name from bboard_forums + where forum_id = :forum_id + + + + + + + + + select short_name as forum_name from bboard_forums + where forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-edit-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-edit-3.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-edit-3.tcl 28 Aug 2003 09:41:47 -0000 1.4 @@ -0,0 +1,50 @@ +ad_page_contract { + + Update edited message + + @author John Prevost + @creation-datee 2000-09-08 + @cvs-id $Id: message-edit-3.tcl,v 1.4 2003/08/28 09:41:47 lars Exp $ + + @param message_id The message to update + @param category_id The new category + @param title The new title + @param content The new content + @param mime_type The new mime type + +} { + forum_id:integer,notnull,bboard_forum_id + message_id:integer,notnull,acs_message_id + category_id:integer,bboard_category_id + title:notnull,trim + content:allhtml,notnull,trim + mime_type:notnull +} -validate { + content_html -requires {content mime_type} { + if [string eq $mime_type "text/html"] { + set complaint [ad_check_for_naughty_html $content] + if ![empty_string_p $complaint] { + ad_complain $complaint + } + } + } +} + +ad_require_permission $message_id bboard_write_message + +db_transaction { + + bboard_message_clear_categories -message_id $message_id + + if ![empty_string_p $category_id] { + bboard_message_add_category -message_id $message_id \ + -category_id $category_id + } + + bboard_message_set -message_id $message_id -title $title \ + -mime_type $mime_type -content $content + +} +# on error ... + +ad_returnredirect "forum?[export_url_vars forum_id]" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-edit.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,82 @@ +ad_page_contract { + + A form for editing a message + + @author John Prevost + @creation-datee 2000-09-08 + @cvs-id $Id: message-edit.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ + + @param message_id The message to edit + +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id +} -properties { + context:onevalue + forum_id:onevalue + forum_name:onevalue + categories:multirow + category_id:onevalue + reply_to:onevalue + quote:onerow + has_quote:onevalue + page_title:onevalue + target:onevalue + title:onevalue + content:onevalue + submit_label:onevalue + message_id:onevalue + msg_mime_type:onevalue +} + +ad_require_permission $message_id bboard_write_message + +db_1row message_info { + select message_id, reply_to, title, mime_type, content + from acs_messages_all m + where message_id = :message_id +} + +set msg_mime_type $mime_type + +set category_id "" + +db_0or1row first_category { + select min(category_id) as category_id from bboard_category_message_map + where message_id = :message_id + group by message_id +} + +db_1row forum_short_name { + select short_name as forum_name from bboard_forums + where forum_id = :forum_id +} + +set page_title "Edit a Message in $forum_name" + +set target "message-edit-2" +set submit_label "Confirm Changes" + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + "Edit a Message"] + +set user_id [ad_verify_and_get_user_id] + +set category_pulldown_list "" + +db_0or1row quote_info { + select m.reply_to, m.title, m.sent_date, + m.mime_type, m.content, + p.first_names||' '||p.last_name as full_name + from acs_messages_all m, persons p + where message_id = :reply_to + and person_id = sender +} -column_array quote + +db_multirow categories category_list { + select c.category_id, c.short_name + from bboard_categories c + where forum_id = :forum_id +} + +ad_return_template "message-entry" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-edit.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-edit.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,61 @@ + + + + + + + select message_id, reply_to, title, mime_type, content + from acs_messages_all m + where message_id = :message_id + + + + + + + + + select min(category_id) as category_id from bboard_category_message_map + where message_id = :message_id + group by message_id + + + + + + + + + select short_name as forum_name from bboard_forums + where forum_id = :forum_id + + + + + + + + + select m.reply_to, m.title, m.sent_date, + m.mime_type, m.content, + p.first_names||' '||p.last_name as full_name + from acs_messages_all m, persons p + where message_id = :reply_to + and person_id = sender + + + + + + + + + select c.category_id, c.short_name + from bboard_categories c + where forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-entry.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-entry.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-entry.adp 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,64 @@ + +@page_title@ +@context@ +message.title + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
In Reply To: + + +
+
Subject:
Category: + +

Message: +
Text type? + +
+
+
Index: openacs-4/contrib/obsolete-packages/bboard/www/message-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-list.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-list.adp 28 Aug 2003 09:41:47 -0000 1.5 @@ -0,0 +1,51 @@ + + There are no messages available.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ScoreSubjectAuthorRepliesLast updateDate
@messages.the_score@@messages.title@@messages.title@@messages.full_name@<%= [expr @messages.num_replies@-1] %>@messages.last_updated@@messages.sent_date@
+
Index: openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2-oracle.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,22 @@ + + + + oracle8.1.6 + + + + + begin + acs_message.send ( + message_id => :new_message_id, + to_address => :email, + grouping_id => :new_message_id, + wait_until => sysdate + ); + end; + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2-postgresql.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,20 @@ + + + + postgresql7.1 + + + + + select acs_message__send ( + :new_message_id, + :email, + :new_message_id, + current_timestamp + ); + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2.tcl 28 Aug 2003 09:41:47 -0000 1.5 @@ -0,0 +1,59 @@ +ad_page_contract { + + Confirmation page for a new posting. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-datee 2000-08-29 + @cvs-id $Id: message-mail-2.tcl,v 1.5 2003/08/28 09:41:47 lars Exp $ + + @param forum_id The forum ID to return to + @param message_id The message ID to copy and return to + @param new_message_id Debounce for the new message creation + @param email Recipient of email +} { + forum_id:integer,notnull,bboard_forum_id + message_id:integer,notnull,acs_message_id + new_message_id:integer,notnull + email:notnull,trim +} + +ad_require_permission $forum_id bboard_create_message + +set user_id [ad_verify_and_get_user_id] +set creation_ip [ad_conn peeraddr] + +db_transaction { + + db_1row user_email { + select email as user_email from parties where party_id = :user_id + } + + db_1row message_info { + select reply_to, sender, title, mime_type, content + from acs_messages_all + where message_id = :message_id + } + + bboard_message_new -message_id $new_message_id \ + -sender $user_id -title "\[Fwd by $user_email\] $title" \ + -mime_type $mime_type -content $content -context_id $message_id + + if ![string equal [bboard_forum_moderated_p $forum_id] "t"] { + bboard_schedule_sends -message_id $message_id + } + + # queue it up to be sent + db_exec_plsql forward_queue { + begin + acs_message.send ( + message_id => :new_message_id, + to_address => :email, + grouping_id => :new_message_id, + wait_until => sysdate + ); + end; + } + +} + +ad_returnredirect "[bboard_message_url $message_id $forum_id]" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-mail-2.xql 28 Aug 2003 09:41:47 -0000 1.3 @@ -0,0 +1,24 @@ + + + + + + + select email as user_email from parties where party_id = :user_id + + + + + + + + + select reply_to, sender, title, mime_type, content + from acs_messages_all + where message_id = :message_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-mail.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-mail.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-mail.adp 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,30 @@ + +Mail to a friend +@context@ +mail.email + +

+ + + +
+ + + + + + + + + + +
Forwarding: + + +
Recipient Email: +
+
+
Index: openacs-4/contrib/obsolete-packages/bboard/www/message-mail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-mail.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-mail.tcl 28 Aug 2003 09:41:47 -0000 1.6 @@ -0,0 +1,52 @@ +ad_page_contract { + + A form for posting a new message to a bboard forum. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-datee 2000-08-29 + @cvs-id $Id: message-mail.tcl,v 1.6 2003/08/28 09:41:47 lars Exp $ + + @param forum_id The forum to post in + @param category_id The default category for the message + @param reply_to The message this post should be in reply to + +} { + forum_id:integer,notnull,bboard_forum_id + message_id:integer,notnull,acs_message_id +} -properties { + context:onevalue + forum_id:onevalue + message:onerow + message_id:onevalue + new_message_id:onevalue + sender_email:onevalue +} + +ad_require_permission $forum_id bboard_create_message + +db_1row forum_short_name { + select short_name as forum_name from bboard_forums + where forum_id = :forum_id +} + +set user_id [ad_verify_and_get_user_id] + +db_1row sender_email { + select email as sender_email from parties + where party_id = :user_id +} + +set new_message_id [db_nextval acs_object_id_seq] + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] "Mail message"] + +db_0or1row message_info { + select reply_to, title, sent_date, + mime_type, content, + first_names||' '||last_name as full_name + from acs_messages_all m, persons p + where message_id = :message_id + and person_id = sender +} -column_array quote + +ad_return_template "message-mail" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-mail.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-mail.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-mail.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,38 @@ + + + + + + + select short_name as forum_name from bboard_forums + where forum_id = :forum_id + + + + + + + + + select email as sender_email from parties + where party_id = :user_id + + + + + + + + + select reply_to, title, sent_date, + mime_type, content, + first_names||' '||last_name as full_name + from acs_messages_all m, persons p + where message_id = :message_id + and person_id = sender + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-move-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-move-2-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-move-2-oracle.xql 28 Aug 2003 09:41:48 -0000 1.4 @@ -0,0 +1,37 @@ + + + + oracle8.1.6 + + + + + update acs_objects + set context_id = :dest_forum_id + where context_id = :forum_id + and object_type = 'bboard_message' + and object_id in (select message_id + from acs_messages m + connect by prior message_id = reply_to + start with message_id = :message_id) + + + + + + + + + update bboard_forum_message_map + set forum_id = :dest_forum_id + where forum_id = :forum_id + and message_id in (select message_id + from acs_messages m + connect by prior message_id = reply_to + start with message_id = :message_id) + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-move-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-move-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-move-2-postgresql.xql 28 Aug 2003 09:41:48 -0000 1.6 @@ -0,0 +1,39 @@ + + + + postgresql7.1 + + + + + update acs_objects + set context_id = :dest_forum_id + where context_id = :forum_id + and object_type = 'bboard_message' + and object_id in + (select m.message_id + from acs_messages m, acs_messages m2 + where m2.message_id = :message_id + and m.tree_sortkey between m2.tree_sortkey and tree_right(m2.tree_sortkey)) + + + + + + + + + update bboard_forum_message_map + set forum_id = :dest_forum_id + where forum_id = :forum_id + and message_id in + (select m.message_id + from acs_messages m, acs_messages m2 + where m2.message_id = :message_id + and m.tree_sortkey between m2.tree_sortkey and tree_right(m2.tree_sortkey)) + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-move-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-move-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-move-2.tcl 28 Aug 2003 09:41:48 -0000 1.4 @@ -0,0 +1,44 @@ +ad_page_contract { + + Moves a message or thread to another forum. + + @author Anukul Kapoor + @creation-date 2001-02-20 + @cvs-id $Id: message-move-2.tcl,v 1.4 2003/08/28 09:41:48 lars Exp $ + +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id + dest_forum_id:integer,notnull,bboard_forum_id +} + +ad_require_permission $forum_id admin +ad_require_permission $dest_forum_id admin + +set user_id [ad_conn user_id] + +db_transaction { + db_dml update_bboard_contexts { + update acs_objects + set context_id = :dest_forum_id + where context_id = :forum_id + and object_type = 'bboard_message' + and object_id in (select message_id + from acs_messages m + connect by prior message_id = reply_to + start with message_id = :message_id) + } + + db_dml move_bboard_messages { + update bboard_forum_message_map + set forum_id = :dest_forum_id + where forum_id = :forum_id + and message_id in (select message_id + from acs_messages m + connect by prior message_id = reply_to + start with message_id = :message_id) + } + +} + +ad_returnredirect "forum?forum_id=$forum_id" \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/message-move.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-move.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-move.adp 28 Aug 2003 09:41:48 -0000 1.4 @@ -0,0 +1,22 @@ + +Move a message +Move + +
+ @form_data@ + + +
+ +Move to this message and its replies to which forum?
+ +
+ +
+
+ Index: openacs-4/contrib/obsolete-packages/bboard/www/message-move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-move.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-move.tcl 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,50 @@ +ad_page_contract { + + Confirmation screem for moving a message to another forum. + + @author Anukul Kapoor + @creation-date 2001-02-20 + @cvs-id $Id: message-move.tcl,v 1.3 2003/08/28 09:41:48 lars Exp $ + +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id + {replies ""} +} -properties { + message_id:onevalue + forum_id:onevalue + title:onevalue + sender_name:onevalue + content:onevalue + msg_mime_type:onevalue + forums:multirow + form_date:onevalue +} + +ad_require_permission $message_id admin + +set user_id [ad_conn user_id] + +db_1row message_info { + select p.first_names ||' '|| p.last_name as sender_name, b.title, + b.mime_type as msg_mime_type, b.content + from bboard_messages_all b, persons p + where message_id = :message_id + and b.sender = p.person_id +} + + +db_multirow forums allowed_target_forums { + select forum_id, short_name + from bboard_forums + where not forum_id = :forum_id + and exists (select 1 from acs_object_party_privilege_map + where object_id = forum_id + and party_id in (:user_id, -1) + and privilege = 'admin') + +} + +set form_data [export_form_vars message_id forum_id] + +ad_return_template \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/message-move.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-move.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-move.xql 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,33 @@ + + + + + + + select p.first_names ||' '|| p.last_name as sender_name, b.title, + b.mime_type as msg_mime_type, b.content + from bboard_messages_all b, persons p + where message_id = :message_id + and b.sender = p.person_id + + + + + + + + + select forum_id, short_name + from bboard_forums + where not forum_id = :forum_id + and exists (select 1 from all_object_party_privilege_map + where object_id = forum_id + and party_id = :user_id + and privilege = 'admin') + + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-new-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-new-2.tcl 28 Aug 2003 09:41:48 -0000 1.6 @@ -0,0 +1,83 @@ +ad_page_contract { + + Confirmation page for a new posting. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-datee 2000-08-29 + @cvs-id $Id: message-new-2.tcl,v 1.6 2003/08/28 09:41:48 lars Exp $ + + @param forum_id The forum to post to + @param title The message title + @param content The message contents + @param category_id The category to post to + @param reply_to The message this is in reply to +} { + forum_id:integer,notnull,bboard_forum_id + title:notnull,trim + content:notnull,allhtml,trim + mime_type:notnull + category_id:integer,bboard_category_id + {reply_to:integer,acs_message_id ""} +} -validate { + content_html -requires {content mime_type} { + if [string eq $mime_type "text/html"] { + set complaint [ad_html_security_check $content] + if ![empty_string_p $complaint] { + ad_complain $complaint + } + } + } +} -properties { + page_title:onevalue + context:onevalue + forum_name:onevalue + content_for_display:onevalue + title:onevalue + message_id:onevalue + form_vars:onevalue + reply_to:onevalue + target:onevalue + subscribe_p:onevalue + msg_mime_type:onevalue +} + +ns_log Notice "mime_type is $mime_type" +set subscribe_p 1 + +set user_id [ad_verify_and_get_user_id] + +ad_require_permission $forum_id bboard_create_message + +set target "message-new-3" + +db_1row forum_short_name { + select short_name as forum_name from bboard_forums + where forum_id = :forum_id +} + +set page_title "Confirm Message for Posting in $forum_name" + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + "Post"] + +set content_for_display [acs_messaging_format_as_html $mime_type $content] + +set message_id [db_nextval acs_object_id_seq] + +set msg_mime_type $mime_type + +set form_vars [export_form_vars message_id forum_id title content \ + mime_type category_id reply_to] + +if ![string equal $reply_to ""] { + set subscribe_p 0 +} else { + if {[string equal [bboard_category_subscribed_p $user_id $category_id] "t"] || + [string equal [bboard_forum_subscribed_p $user_id $forum_id] "t"]} { + set subscribe_p 0 + } else { + set subscribe_p 1 + } +} + +ad_return_template "message-preview" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-new-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-new-2.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-new-2.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,14 @@ + + + + + + + select short_name as forum_name from bboard_forums + where forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-new-3-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-new-3-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-new-3-oracle.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,17 @@ + + + + oracle8.1.6 + + + + + begin + acs_permission.grant_permission(:message_id, :user_id, 'bboard_write_message'); + end; + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-new-3-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-new-3-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-new-3-postgresql.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,15 @@ + + + + postgresql7.1 + + + + + select acs_permission__grant_permission(:message_id, :user_id, 'bboard_write_message'); + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-new-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-new-3.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-new-3.tcl 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,63 @@ +ad_page_contract { + + Confirmation page for a new posting. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-datee 2000-08-29 + @cvs-id $Id: message-new-3.tcl,v 1.5 2003/08/28 09:41:48 lars Exp $ + + @param forum_id + @param short_name + @param content + @param mime_type +} { + message_id:integer,notnull + forum_id:integer,notnull,bboard_forum_id + category_id:integer,bboard_category_id + title:notnull,trim + content:allhtml,notnull,trim + mime_type:notnull + {reply_to:integer,acs_message_id ""} + {subscribe_p:optional ""} +} + +ad_require_permission $forum_id bboard_create_message + +set user_id [ad_verify_and_get_user_id] +set creation_ip [ad_conn peeraddr] + +db_transaction { + + bboard_message_new -message_id $message_id -reply_to $reply_to \ + -sender $user_id -title $title -mime_type $mime_type \ + -content $content -context_id $forum_id \ + -creation_ip $creation_ip + + bboard_message_set_status \ + -message_id $message_id -forum_id $forum_id -status "unmoderated" + + if {![empty_string_p $category_id]} { + bboard_message_add_category \ + -message_id $message_id -category_id $category_id + } + + if ![empty_string_p $subscribe_p] { + bboard_subscribe_thread -thread_id $message_id -subscriber_id $user_id + } + + if ![string equal [bboard_forum_moderated_p $forum_id] "t"] { + bboard_alert_one_mesg -message_id $message_id -forum_id $forum_id \ + -user_id $user_id -creation_ip $creation_ip + } + + if [string equal [ad_parameter "UserPostsEditableP"] "t"] { + db_exec_plsql grant { + begin + acs_permission.grant_permission(:message_id, :user_id, 'bboard_write_message'); + end; + } + } + +} + +ad_returnredirect "forum?[export_url_vars forum_id]" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-new.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-new.tcl 28 Aug 2003 09:41:48 -0000 1.6 @@ -0,0 +1,85 @@ +ad_page_contract { + + A form for posting a new message to a bboard forum. + + @author Anukul Kapoor (akk@arsdigita.com) + @creation-datee 2000-08-29 + @cvs-id $Id: message-new.tcl,v 1.6 2003/08/28 09:41:48 lars Exp $ + + @param forum_id The forum to post in + @param category_id The default category for the message + @param reply_to The message this post should be in reply to + +} { + forum_id:integer,notnull,bboard_forum_id + {category_id:integer,bboard_category_id ""} + {reply_to:integer,acs_message_id ""} +} -properties { + context:onevalue + forum_id:onevalue + forum_name:onevalue + categories:multirow + category_id:onevalue + reply_to:onevalue + quote:onerow + has_quote:onevalue + page_title:onevalue + target:onevalue + title:onevalue + content:onevalue + submit_label:onevalue + message_id:onevalue +} + +ad_require_permission $forum_id bboard_create_message + +db_1row forum_short_name { + select short_name as forum_name from bboard_forums + where forum_id = :forum_id +} + +set page_title "Post a New Message to $forum_name" + +set target "message-new-2" +set submit_label "Post Message" + +set title "" +set content "" + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + "Post"] + +set user_id [ad_verify_and_get_user_id] + +set category_pulldown_list "" + +db_0or1row quote_info { + select reply_to, title, sent_date, + mime_type, content, + first_names||' '||last_name as full_name + from acs_messages_all m, persons p + where message_id = :reply_to + and person_id = sender +} -column_array quote + +if ![empty_string_p $reply_to] { + if [string equal -length 4 -nocase "Re: " $quote(title)] { + set title $quote(title) + } else { + set title "Re: $quote(title)" + } +} + +db_0or1row quote_first_category { + select min(category_id) as category_id from bboard_category_message_map + where message_id = :reply_to + group by message_id +} + +db_multirow categories category_list { + select category_id, short_name + from bboard_categories + where forum_id = :forum_id +} + +ad_return_template "message-entry" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-new.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-new.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-new.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,50 @@ + + + + + + + select short_name as forum_name from bboard_forums + where forum_id = :forum_id + + + + + + + + + select reply_to, title, sent_date, + mime_type, content, + first_names||' '||last_name as full_name + from acs_messages_all m, persons p + where message_id = :reply_to + and person_id = sender + + + + + + + + + select min(category_id) as category_id from bboard_category_message_map + where message_id = :reply_to + group by message_id + + + + + + + + + select category_id, short_name + from bboard_categories + where forum_id = :forum_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-oracle.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,61 @@ + + + + oracle8.1.6 + + + + + select short_name as forum_name, + acs_permission.permission_p(:forum_id, :user_id, 'admin') as admin_p, + acs_permission.permission_p(:forum_id, :user_id, 'bboard_moderate_forum') + as moderate_p + from bboard_forums + where forum_id = :forum_id + + + + + + + + select message_id, reply_to, title, + to_char(sent_date, 'Month DD, YYYY HH:Mi am') as pretty_date, sender as user_id, + mime_type, content, first_names||' '||last_name as full_name, + acs_permission.permission_p(message_id, :user_id, + 'bboard_write_message') as write_p + from acs_messages_all m, persons p + where message_id = :message_id + and person_id = sender + + + + + + + + + select m.message_id, m.reply_to, m.title, m.mime_type, m.content, + to_char(m.sent_date,'Month DD, YYYY HH:Mi am') as pretty_date, sender as user_id, + p.first_names||' '||p.last_name as full_name, + mt.depth - 1 as thread_depth, rownum, + acs_permission.permission_p(m.message_id, :user_id, + 'bboard_write_message') as write_p + from acs_messages_all m, persons p, + (select message_id, level as depth, rownum as seqnum + from acs_messages + connect by prior message_id = reply_to + start with message_id = :message_id) mt + where m.message_id <> :message_id + and p.person_id = m.sender + and m.message_id = mt.message_id + and m.message_id in (select bfmm.message_id + from bboard_forum_message_map bfmm + where bfmm.forum_id = :forum_id) + order by m.sent_date + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-postgresql.xql 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,58 @@ + + + + postgresql7.1 + + + + + select short_name as forum_name, + acs_permission__permission_p(:forum_id, :user_id, 'admin') as admin_p, + acs_permission__permission_p(:forum_id, :user_id, 'bboard_moderate_forum') + as moderate_p + from bboard_forums + where forum_id = :forum_id + + + + + + + + + select message_id, reply_to, title, + to_char(sent_date, 'Month DD, YYYY HH:MI am') as pretty_date, sender as user_id, + mime_type, content, first_names||' '||last_name as full_name, + acs_permission__permission_p(message_id, :user_id, + 'bboard_write_message') as write_p + from acs_messages_all m, persons p + where message_id = :message_id + and person_id = sender + + + + + + + + + select m.message_id, m.reply_to, m.title, m.mime_type, m.content, + to_char(m.sent_date,'Month DD, YYYY HH:MI am') as pretty_date, m.sender as user_id, + p.first_names||' '||p.last_name as full_name, + tree_level(m.tree_sortkey) - 1 as thread_depth, + acs_permission__permission_p(m.message_id, :user_id, + 'bboard_write_message') as write_p + from acs_messages_all m, acs_messages m2, persons p, bboard_forum_message_map bfmm + where m2.message_id = :message_id + and m.message_id <> :message_id + and bfmm.forum_id = :forum_id + and m.tree_sortkey between m2.tree_sortkey and tree_right(m2.tree_sortkey) + and p.person_id = m.sender + and m.message_id = bfmm.message_id + order by m.sent_date + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-preview.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-preview.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-preview.adp 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,14 @@ + +@page_title@ +@context@ + +
+ @form_vars@ + +
+
+ +   Subscribe to replies +
+ Index: openacs-4/contrib/obsolete-packages/bboard/www/message-reject.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-reject.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-reject.tcl 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,19 @@ +ad_page_contract { + + Marks a message as rejected for display in a moderated forum. + + @author John Prevost + @creation-date 2000-09-10 + @cvs-id $Id: message-reject.tcl,v 1.3 2003/08/28 09:41:48 lars Exp $ + +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id +} + +ad_require_permission $forum_id bboard_moderate_forum + +bboard_message_set_status \ + -message_id $message_id -forum_id $forum_id -status "rejected" + +ad_returnredirect "forum?forum_id=$forum_id" Index: openacs-4/contrib/obsolete-packages/bboard/www/message-subscribe.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-subscribe.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-subscribe.tcl 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,22 @@ +ad_page_contract { + + Subscribe the current user to a given message thread. + + @author John Prevost + @creation-date 2000-10-28 + @cvs-id $Id: message-subscribe.tcl,v 1.3 2003/08/28 09:41:48 lars Exp $ + +} { + forum_id:integer,notnull,bboard_forum_id + message_id:integer,notnull,acs_message_id +} + +# Not strictly right +ad_require_permission $forum_id bboard_create_message + +catch { + bboard_subscribe_thread \ + -thread_id $message_id -subscriber_id [ad_verify_and_get_user_id] +} + +ad_returnredirect "[bboard_message_page]?forum_id=$forum_id&message_id=$message_id" \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/message-threaded-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-threaded-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-threaded-oracle.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,46 @@ + + + + oracle8.1.6 + + + + + select short_name as forum_name, + acs_permission.permission_p(:forum_id, :user_id, 'admin') as admin_p, + acs_permission.permission_p(:forum_id, :user_id, 'bboard_moderate_forum') + as moderate_p + from bboard_forums + where forum_id = :forum_id + + + + + + + + + select m.message_id, m.reply_to, m.title, m.sent_date, m.mime_type, + to_char(m.sent_date, 'Month DD, YYYY HH:Mi am') as pretty_date, + m.content, p.first_names||' '||p.last_name as full_name, + p.person_id as user_id, + mt.depth - 1 as thread_depth, + acs_permission.permission_p(m.message_id, :user_id, + 'bboard_write_message') as write_p + from acs_messages_all m, persons p, + (select message_id, level as depth, rownum as seqnum + from acs_messages im + connect by prior message_id = reply_to + start with message_id = :message_id) mt + where p.person_id = m.sender + and m.message_id = mt.message_id + and m.message_id in (select bfmm.message_id + from bboard_forum_message_map bfmm + where bfmm.forum_id = :forum_id) + order by seqnum + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-threaded-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-threaded-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-threaded-postgresql.xql 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,42 @@ + + + + postgresql7.1 + + + + + select short_name as forum_name, + acs_permission__permission_p(:forum_id, :user_id, 'admin') as admin_p, + acs_permission__permission_p(:forum_id, :user_id, 'bboard_moderate_forum') + as moderate_p + from bboard_forums + where forum_id = :forum_id + + + + + + + + + select m.message_id, m.reply_to, m.title, m.sent_date, m.mime_type, + to_char(m.sent_date, 'Month DD, YYYY HH:MI am') as pretty_date, + m.content, p.first_names||' '||p.last_name as full_name, + p.person_id as user_id, + tree_level(m.tree_sortkey) - 1 as thread_depth, + acs_permission__permission_p(m.message_id, :user_id, + 'bboard_write_message') as write_p + from acs_messages_all m, persons p, acs_messages m2, bboard_forum_message_map bfmm + where m2.message_id = :message_id + and bfmm.forum_id = :forum_id + and m.tree_sortkey between m2.tree_sortkey and tree_right(m2.tree_sortkey) + and p.person_id = m.sender + and m.message_id = bfmm.message_id + order by m.tree_sortkey + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-threaded.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-threaded.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-threaded.adp 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,33 @@ + +@context@ +@forum_name@: @title@ + + + +
+ + [Move Thread] + + + [Subscribe to replies] + + + You're subscribed to replies [Unsubscribe] + +

+ + + + + +
+ + +
+ Index: openacs-4/contrib/obsolete-packages/bboard/www/message-threaded.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-threaded.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-threaded.tcl 28 Aug 2003 09:41:48 -0000 1.7 @@ -0,0 +1,69 @@ +ad_page_contract { + + Displays a single message, and all replies in a threaded fashion. + + @author John Prevost + @creation-date 2000-09-01 + @cvs-id $Id: message-threaded.tcl,v 1.7 2003/08/28 09:41:48 lars Exp $ +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id +} -properties { + title:onevalue + context:onevalue + forum_name:onevalue + forum_id:onevalue + message:onerow + replies:multirow + subscribed_p:onevalue +} + +ad_require_permission $message_id bboard_read_forum + +set user_id [ad_verify_and_get_user_id] + +if [string equal [bboard_message_subscribed_p -direct $user_id $message_id] "t"] { + set subscribed_p 1 +} else { + set subscribed_p 0 +} + +db_1row forum_short_name { + select short_name as forum_name, + acs_permission.permission_p(:forum_id, :user_id, 'admin') as admin_p, + acs_permission.permission_p(:forum_id, :user_id, 'bboard_moderate_forum') + as moderate_p + from bboard_forums + where forum_id = :forum_id +} + +db_1row thread_title { + select title + from acs_messages_all + where message_id = :message_id +} + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] "One Message"] + +db_multirow messages messages_and_replies { + select m.message_id, m.reply_to, m.title, m.sent_date, m.mime_type, + to_char(m.sent_date, 'Month DD, YYYY HH:Mi am') as pretty_date, + m.content, p.first_names||' '||p.last_name as full_name, + p.person_id as user_id, + mt.depth - 1 as thread_depth, + acs_permission.permission_p(m.message_id, :user_id, + 'bboard_write_message') as write_p + from acs_messages_all m, persons p, + (select message_id, level as depth, rownum as seqnum + from acs_messages + connect by prior message_id = reply_to + start with message_id = :message_id) mt + where p.person_id = m.sender + and m.message_id = mt.message_id + and m.message_id in (select bfmm.message_id + from bboard_forum_message_map bfmm + where bfmm.forum_id = :forum_id) + order by seqnum +} + +ad_return_template Index: openacs-4/contrib/obsolete-packages/bboard/www/message-threaded.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-threaded.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-threaded.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,15 @@ + + + + + + + select title + from acs_messages_all + where message_id = :message_id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/message-unsubscribe.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message-unsubscribe.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message-unsubscribe.tcl 28 Aug 2003 09:41:48 -0000 1.4 @@ -0,0 +1,24 @@ +ad_page_contract { + + Unsubscribe the current user from a given mesage thread. + + @author John Prevost + @creation-date 2000-10-28 + @cvs-id $Id: message-unsubscribe.tcl,v 1.4 2003/08/28 09:41:48 lars Exp $ + +} { + forum_id:integer,notnull,bboard_forum_id + message_id:integer,notnull,acs_message_id + {sub_page ""} +} + +catch { + bboard_unsubscribe_thread \ + -thread_id $message_id -subscriber_id [ad_verify_and_get_user_id] +} + +if [empty_string_p $sub_page] { + ad_returnredirect "[bboard_message_page]?forum_id=$forum_id&message_id=$message_id" +} else { + ad_returnredirect "subscriptions" +} Index: openacs-4/contrib/obsolete-packages/bboard/www/message.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message.adp 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,52 @@ + +@context@ +@forum_name@: @message.title@ + + +
+ + [Delete Thread] + + + + [Move Thread] + + [Subscribe to replies] + + + You're subscribed to replies [Unsubscribe] + +
+ + +

Message:

+
+ +
+ +

Replies:

+ +
+ + +
+ +
+
+
+
+ +
+ + + +
+ Index: openacs-4/contrib/obsolete-packages/bboard/www/message.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/message.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/message.tcl 28 Aug 2003 09:41:48 -0000 1.6 @@ -0,0 +1,76 @@ +ad_page_contract { + + Displays a single message, and all replies. + + @author John Prevost + @creation-date 2000-09-01 + @cvs-id $Id: message.tcl,v 1.6 2003/08/28 09:41:48 lars Exp $ +} { + message_id:integer,notnull,acs_message_id + forum_id:integer,notnull,bboard_forum_id +} -properties { + message_create_p:onevalue + context:onevalue + forum_name:onevalue + forum_id:onevalue + message:onerow + replies:multirow + subscribed_p:onevalue + moderate_p:onevalue +} + +ad_require_permission $message_id bboard_read_forum + +set user_id [ad_verify_and_get_user_id] + +if [string equal [bboard_message_subscribed_p -direct $user_id $message_id] "t"] { + set subscribed_p 1 +} else { + set subscribed_p 0 +} + +db_1row forum_short_name { + select short_name as forum_name, + acs_permission.permission_p(:forum_id, :user_id, 'admin') as admin_p, + acs_permission.permission_p(:forum_id, :user_id, 'bboard_moderate_forum') + as moderate_p + from bboard_forums + where forum_id = :forum_id +} + +db_1row message_info { + select message_id, reply_to, title, + to_char(sent_date, 'Month DD, YYYY HH:Mi am') as pretty_date, sender as user_id, + mime_type, content, first_names||' '||last_name as full_name, + acs_permission.permission_p(message_id, :user_id, + 'bboard_write_message') as write_p + from acs_messages_all m, persons p + where message_id = :message_id + and person_id = sender +} -column_array message + +set context [list [list "forum?[export_url_vars forum_id]" $forum_name] \ + "One Message"] + +db_multirow replies message_replies { + select m.message_id, m.reply_to, m.title, m.mime_type, m.content, + to_char(m.sent_date,'Month DD, YYYY HH:Mi am') as pretty_date, sender as user_id, + p.first_names||' '||p.last_name as full_name, + mt.depth - 1 as thread_depth, rownum, + acs_permission.permission_p(m.message_id, :user_id, + 'bboard_write_message') as write_p + from acs_messages_all m, persons p, + (select message_id, level as depth, rownum as seqnum + from acs_messages im + connect by prior message_id = reply_to + start with message_id = :message_id) mt + where m.message_id <> :message_id + and p.person_id = m.sender + and m.message_id = mt.message_id + and m.message_id in (select bfmm.message_id + from bboard_forum_message_map bfmm + where bfmm.forum_id = :forum_id) + order by m.sent_date +} + +ad_return_template Index: openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.adp 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,22 @@ + +@title@ +@context@ + + + There are no messages for this user this forum.

+ + + + + + +

+ + +Posting History in Other Forums: +

+
\ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.tcl 28 Aug 2003 09:41:48 -0000 1.6 @@ -0,0 +1,79 @@ +ad_page_contract { + + Displays a given user's posting history. + + @author Anukul Kapoor + @creation-date 2000-11-22 + @cvs-id $Id: messages-by-user.tcl,v 1.6 2003/08/28 09:41:48 lars Exp $ + +} { + user_id:integer,notnull + forum_id:integer,notnull,bboard_forum_id +} -properties { + context:onevalue + title:onevalue + forum_name:onevalue + forum_id:onevalue + messages:multirow +} + +set current_user_id [ad_verify_and_get_user_id] + +ad_require_permission $forum_id bboard_read_forum + +db_1row user_info { + select first_names||' '||last_name as full_name + from persons + where person_id = :user_id +} + +db_1row forum_info { + select short_name as forum_name, moderated_p from bboard_forums + where forum_id = :forum_id +} + +if [string equal $moderated_p f] { + + db_multirow messages messages_select { + select title, num_replies, message_id, + first_names||' '||last_name as full_name + from bboard_messages_all, persons + where sender = :user_id + and forum_id = :forum_id + and person_id = sender + } +} else { + db_multirow messages messages_select { + select title, num_replies, message_id, + first_names||' '||last_name as full_name + from bboard_messages_all, persons + where sender = :user_id + and forum_id = :forum_id + and person_id = sender + and status = 'approved' + } +} + + +set package_id [ad_conn package_id] + +db_multirow alt_forums alt_forums_select { + select forum_id, short_name + from bboard_forums bf + where not forum_id = :forum_id + and bboard_id = :package_id + and exists (select 1 + from bboard_messages_all bma + where sender = :user_id + and bma.forum_id = bf.forum_id) + and exists (select 1 from acs_object_party_privilege_map + where object_id = bf.forum_id + and party_id in (:current_user_id, -1) + and privilege = 'bboard_read_forum') +} + +set title "Posting History for $full_name in $forum_name" + +set context [list $forum_name] + +ad_return_template Index: openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/messages-by-user.xql 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,73 @@ + + + + + + + select first_names||' '||last_name as full_name + from persons + where person_id = :user_id + + + + + + + + + select short_name as forum_name, moderated_p from bboard_forums + where forum_id = :forum_id + + + + + + + + + select title, num_replies, message_id, + first_names||' '||last_name as full_name + from bboard_messages_all, persons + where sender = :user_id + and forum_id = :forum_id + and person_id = sender + + + + + + + + + select title, num_replies, message_id, + first_names||' '||last_name as full_name + from bboard_messages_all, persons + where sender = :user_id + and forum_id = :forum_id + and person_id = sender + + + + + + + + + select forum_id, short_name + from bboard_forums bf + where not forum_id = :forum_id + and bboard_id = :package_id + and exists (select 1 + from bboard_messages_all bma + where sender = :user_id + and bma.forum_id = bf.forum_id) + and exists (select 1 from all_object_party_privilege_map + where object_id = bf.forum_id + and party_id = :current_user_id + and privilege = 'bboard_read_forum') + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/search-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/search-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/search-oracle.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,33 @@ + + + + oracle8.1.6 + + + + + select bboard_im_convert(:query) as query from dual + + + + + + + + + select score(10) as the_score, message_id, + m.title, m.num_replies, to_char(m.sent_date,'MM/DD/YYYY') as sent_date, + p.first_names||' '||p.last_name as full_name + from bboard_messages_all m, persons p, bboard_forums f + where contains(content, :query, 10) > 0 + and m.sender = p.person_id + and m.forum_id = :forum_id + and f.forum_id = m.forum_id + and f.bboard_id = :package_id + order by score(10) desc + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/search-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/search-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/search-postgresql.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,31 @@ + + + + postgresql7.1 + + + + + select :query as query + + + + + + + + + select 10 as the_score, message_id, + m.title, m.num_replies, to_char(m.sent_date,'MM/DD/YYYY') as sent_date, + p.first_names||' '||p.last_name as full_name + from bboard_messages_all m, persons p, bboard_forums f + where content like '%' || :query || '%' + and m.sender = p.person_id + and m.forum_id = :forum_id + and f.forum_id = m.forum_id + and f.bboard_id = :package_id + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/search.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/search.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/search.adp 28 Aug 2003 09:41:48 -0000 1.4 @@ -0,0 +1,7 @@ + +@context@ +@title@ + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/search.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/search.tcl 28 Aug 2003 09:41:48 -0000 1.6 @@ -0,0 +1,50 @@ +ad_page_contract { + + Displays search results from a user query. + + @author Anukul Kapoor + @creation-date 2000-10-26 + @cvs-id $Id: search.tcl,v 1.6 2003/08/28 09:41:48 lars Exp $ +} { + query:notnull + forum_id:integer,notnull,bboard_forum_id +} -properties { + query:onevalue + results:multirow + forum_id:onevalue + context:onevalue + title:onevalue +} + +set user_id [ad_verify_and_get_user_id] + +set title "Search Results for \"$query\"" +set context [list "Search"] + +set package_id [ad_conn package_id] + +ad_require_permission $forum_id bboard_read_forum + +# convert query string to im happy query string + +db_1row im_convert_query { + select bboard_im_convert(:query) as query from dual +} + +# if you're not running context, you'll need to run this by hand +# alter index cr_rev_content_index rebuild online parameters('sync memory 45M'); + +db_multirow results bboard_search { + select score(10) as the_score, message_id, + m.title, m.num_replies, to_char(m.sent_date,'MM/DD/YYYY') as sent_date, + p.first_names||' '||p.last_name as full_name + from bboard_messages_all m, persons p, bboard_forums f + where contains(content, :query, 10) > 0 + and m.sender = p.person_id + and m.forum_id = :forum_id + and f.forum_id = m.forum_id + and f.bboard_id = :package_id + order by score(10) desc +} + +ad_return_template Index: openacs-4/contrib/obsolete-packages/bboard/www/simple-message-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/simple-message-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/simple-message-oracle.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,20 @@ + + + + oracle8.1.6 + + + + + select object_id as file_id, cr.title, ci.name + from acs_objects ao, cr_items ci, cr_revisions cr + where object_id = ci.item_id and + live_revision = revision_id and + object_type = 'content_item' and + context_id = :id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/simple-message-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/simple-message-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/simple-message-postgresql.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,20 @@ + + + + postgresql7.1 + + + + + select object_id as file_id, cr.title, ci.name + from acs_objects ao, cr_items ci, cr_revisions cr + where object_id = ci.item_id and + live_revision = revision_id and + object_type = 'content_item' and + context_id = :id + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/simple-message.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/simple-message.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/simple-message.adp 28 Aug 2003 09:41:48 -0000 1.4 @@ -0,0 +1,75 @@ +<% # A simple single message + # This should, in the future, use a row variable rather than many + # single values, but row variables are not yet supported. %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Subject: + + @title@ + + + @title@ + +   + + + [edit] + + [attach file] + + + + [delete] + + + [email] + + + [reply] + +
Message:
<%= @formatted_content@ %>
 
+ + -- @author@, @date@ + + + -- @author@, @date@ + +
Attachment: + + @attachments.name@ - @attachments.title@ + + [delete] +
+
Index: openacs-4/contrib/obsolete-packages/bboard/www/simple-message.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/simple-message.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/simple-message.tcl 28 Aug 2003 09:41:48 -0000 1.4 @@ -0,0 +1,43 @@ +ad_page_contract { + Display a single message in a reasonable way. + + @author John Prevost + @author Anukul Kapoor + @creation-date 2000-11-30 + @cvs-id $Id: simple-message.tcl,v 1.4 2003/08/28 09:41:48 lars Exp $ +} { +} -properties { + mail_friend_p:onevalue + attachments_p:onevalue + attachments:multirow + formatted_content:onevalue +} + +set mail_friend_p [ad_parameter "MailFriendEnabledP"] +set attachments_p [ad_parameter "AttachmentsEnabledP"] + +if {[ad_parameter "UserPostsDeletableP"] == "t"} { + if [info exists write_p] { + set delete_p $write_p + } +} else { + if [info exists admin_p] { + set delete_p $admin_p + } +} + +set formatted_content [acs_messaging_format_as_html $mime_type $content] + +# we don't want to stomp on the +set current_user_id [ad_conn user_id] + +if {[string equal $attachments_p "t"] && [info exists id]} { + db_multirow attachments get_attachments { + select object_id as file_id, cr.title, ci.name + from acs_objects ao, cr_items ci, cr_revisions cr + where object_id = ci.item_id and + live_revision = revision_id and + object_type = 'content_item' and + context_id = :id + } +} Index: openacs-4/contrib/obsolete-packages/bboard/www/subscriptions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/subscriptions.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/subscriptions.adp 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,39 @@ + +@title@ +@context@ + +You have the follow subscriptions:
+ +

Forums

+ + + +

Categories

+ + + +

Individual Threads

+ + + +

+ +Add subscriptions from within particular forums. \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/subscriptions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/subscriptions.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/subscriptions.tcl 28 Aug 2003 09:41:48 -0000 1.5 @@ -0,0 +1,52 @@ +ad_page_contract { + This is the central interface for managing a user's subscriptions. + + @author Anukul Kapoor + @creation-date 2001-03-27 + @cvs-id $Id: subscriptions.tcl,v 1.5 2003/08/28 09:41:48 lars Exp $ +} { +} -properties { + title:onevalue + context:onevalue + forum_subs:multirow + category_subs:multirow + thread_subs:multirow +} + +ad_maybe_redirect_for_registration + +set user_id [ad_verify_and_get_user_id] + +set title "Manage Subscriptions" +set context [list $title] + +# three sorts of subscriptions: +# forums + +db_multirow forum_subs get_forum_subs { + select bfs.forum_id, short_name as name + from bboard_forum_subscribers bfs, bboard_forums bf + where bfs.forum_id = bf.forum_id + and bfs.subscriber_id = :user_id + order by forum_id asc +} + +# categories +db_multirow category_subs get_category_subs { + select bcs.category_id, short_name as name, forum_id + from bboard_category_subscribers bcs, bboard_categories bc + where bcs.category_id = bc.category_id + and bcs.subscriber_id = :user_id + order by category_id asc +} + + +# threads + +db_multirow thread_subs get_thread_subs { + select thread_id, title as name, forum_id + from bboard_thread_subscribers bts, bboard_messages_all bma + where bts.thread_id = bma.message_id + and bts.subscriber_id = :user_id + order by thread_id asc +} \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/subscriptions.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/subscriptions.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/subscriptions.xql 28 Aug 2003 09:41:48 -0000 1.3 @@ -0,0 +1,43 @@ + + + + + + + select bfs.forum_id, short_name as name + from bboard_forum_subscribers bfs, bboard_forums bf + where bfs.forum_id = bf.forum_id + and bfs.subscriber_id = :user_id + order by forum_id asc + + + + + + + + + select bcs.category_id, short_name as name, forum_id + from bboard_category_subscribers bcs, bboard_categories bc + where bcs.category_id = bc.category_id + and bcs.subscriber_id = :user_id + order by category_id asc + + + + + + + + + select thread_id, title as name, forum_id + from bboard_thread_subscribers bts, bboard_messages_all bma + where bts.thread_id = bma.message_id + and bts.subscriber_id = :user_id + order by thread_id asc + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/test.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/test.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/test.adp 28 Aug 2003 09:41:48 -0000 1.4 @@ -0,0 +1,15 @@ + + +test + +

<%=[ns_quotehtml "{}{}{}<><><>bar"]%>
+ +
<%=[ad_conn location] [ad_conn package_url] %>
+
<%= [bboard_message_url 8035 1592]%>
+
<%= [bboard_message_url -absolute 8035 1592]%>
+
<%= %>
+
<%= %>
+
<%= %>
+ + +<% bboard_garbage_collect %> \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/design.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/design.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/design.html 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,273 @@ + + +ACS Messaging & BBoard Design Document + + + + +

ACS Message & BBoard Design Document

+by Anukul Kapoor + +
+ +

I. Essentials

+ + + + +

II. Introduction

+ +

bboard is an ACS application package built to provide +scalable discussion forums to a community of users. As in older +versions, bboard provides: +

    +
  • posting, browsing, and reading of messages in discussion forums +
  • tools for moderators to maintain editorial standards +
  • categorization and retrieval for knowledge management +
+ +The initial 4.0 implementation adds the following new features: + +
    +
  • fully templated presentation layer for easy customization +
  • improved access control on bboard operations to support a wide +variety of publisher policies +
  • support for multiple distinct configurations of the bboard package +(e.g. different forums and options at http://foo.com/bboard/ and +http://foo.com/pittsburgh/bboard/) +
+

+ +

The ACS 4.0 version of bboard is a re-engineering of +the data model and presentation layer without certain capabilities +present in the ACS 3.4 bboard. In future releases we intend to +achieve the same level of maturity as the older bboard +while building on the flexibility of the new design.

+ +In particular this implementation (9/2000) does not include the +following features found in prior versions: + +
    +
  • support for expiring messages +
  • facilities for spamming dynamic classes of bboard users +
  • bboard messages with rich media attachments +
  • email alert functionality +
  • full text messages searching +
+ +

bboard is not intended to be the ultimate +customizable web based discussion system. It is intended to be a +practical and useful system that supports forums much like the +photo.net Q&A forum. Publishers with special needs are encouraged to +implement their solution as a module, much like bboard, built atop the +framework acs-messaging provides. + +

acs-messaging is a general purpose component that +provides threaded messaging services to higher level applications such +as bboard. The motivation is to provide a base level +data model and reusable presentation code that enables the rapid +customization of messaging applications. acs-messaging is intended to +simplify modules like general comments and +webmail, as well as specialized messaging applications +such as scorecard's geospatial +bboard. Such a framework keeps custom organizational metadata, +pageflow and navigation, and publishing and moderation policy separate +from the basic tools needed for discussion.

+ +

III. Historical Considerations

+ +Over the course of ACS development, bboard has grown to +encompass a wide variety of functionality. Much of this functionality +was developed first for bboard and only later adapted +into more general mechanisms (e.g. alerts, security, group scoping, +etc.,). However bboard wasn't refactored to take +advantage of the more general facilities, and its complexity +challenged those in need of custom features. Furthermore there was a +lot of ad hoc mechanism in both the data model and page flow to +support different presentation styles, navigation schemes, and access +control models. Although this bboard proved to be +useful, scalable, and reliable, the ability to maintain and extend +this code suffered.

+ +The ACS 4.0 release of bboard mimics the basic functionality of older +bboard versions but built atop new ACS 4.0 general +mechanisms (objects, persmissions, templating, acs-messaging, +etc.,).

. + +

IV. Competitive Analysis

+ +An analysis of the bboard feature space should be added here. + +
    +
  • USENET a la gnus +
  • slashdot +
  • Userland +
  • ???? +
+ +

V. Design Tradeoffs

+ +

How does one reconcile all the possible discussion forums mentioned +above into a single module? One does not! bboard is +precisely one way to implement a discussion forum and should not be +all things. In time, there should be a toolkit of components (user +interface, data model, and procedural) for developers to assemble +their custom.

+ +

Although many of the entities in the data model are implemented as +subtyples of ACS object, we avoid using information from the ACS +object table for anything but auditing purposes. For example, we +could store a message's author in the ACS object creation_user field, +however to keep query performance in line we rather use the author field +in acs_messages.

+ +

VI. API

+ +

As of the initial ACS 4.0 release, acs-messaging and +bboard do not provide well defined programming +interfaces.

+ +

Although convenience functions will be provided for basic +transactions on the acs-messaging and bboard +entities, it remains to be seen what sort of abstraction layer is most +appropriate.

+ +

VII. Data Model Discussion

+ +

acs-messaging defines the view +acs_messages_all for the storage and access of threaded +text messages and assorted information relevant to their display, +access, and creation. Under the covers acs-messaging use the +content repository for underlying storage.

+ +

bboard uses acs-messaging messages, and +organizes them into forums and categories. For the purposed of the +ACS permissions system, forums contain messages, and so any +permissions on a forum will default to being inherited for individual +messages.

+ +

A forum may be designated as moderated, in which case explicit +approvals or denials are stored in the +bboard_message_moderation. Messages without entries in +the moderation table are considered unseen, and will be displayed or +hidden in moderated forums based on policy.

+ +

Each forum may have some number of categories, tags denoting further +specialization within a forum. Messages of a forum may be tagged as being +in any of the categories pertaining to that forum.

+ +

Permissions

+ +Permissions in ACS 4.0 involve 3 interrelated hierarchies: users & +groups, objects, and privileges. The user and group hiearchy is +generally explained elsewhere. + +The short explanation:

+ +The long explanation:
+ +BBoard defines the following permissions: +

    + +
  • nested under the create permission: +
  • bboard_create_forum +
  • bboard_create_category +
  • bboard_create_message +
  • +
  • nested under the write permission: +
  • bboard_write_forum +
  • bboard_write_category +
  • bboard_write_message +
  • +
  • nested under the read permission: +
  • bboard_read_forum +
  • bboard_read_category +
  • bboard_read_message +
  • +
  • nested under the delete permission: +
  • bboard_delete_forum +
  • bboard_delete_category +
  • bboard_delete_message +
  • +
  • nested under the moderate permission: +
  • bboard_moderate_forum +
+ +

VIII. User Interface

+ +

IX. Configuration/Parameters

+ +

X. Acceptance Tests

+ +

XI. Future Improvements/Areas of Likely Change

+ +

Much of the functionality of the ACS content repository will +eventually provide tangible benefits to bboard and any +acs-messaging application. Foremost among these features +will be full text searching and rich media attachments.

+ +

When ACS provides a general mechanism for an installation to send and +receive email, bboard can provide email alerts and +email based reply and post.

+ +

XII. Authors

+ +Anukul Kapoor + +

XIII. Revision History

+ + + + + + + + + + + + + + + + + + + + + + + +
Document Revision #Action Taken, NotesWhen?By Whom?
0.1Creation09/01/2000Anukul Kapoor
0.2Revision09/19/2000Anukul Kapoor
+ + + +

+ +


+ +akk@arsdigita.com + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/index.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/index.html 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,225 @@ + +BBoard documentation + +

BBoard documentation

+
+

Release Notes

+ +Version 4.0.2b6 of BBoard is Yet Another Attempt to get 4.0.2 +released. This version requires ACS 4.0.1 but has been tested against +4.1 as well. A lot of bugs have been fixed and minor features implemented: + +
    +
  • emailing a friend or email alerts should no longer leave persistent garbage around. +
  • a link is now provided for uncategorized messages. +
  • cleaner views +
  • deletion of threads as well as just messages +
  • email alerts show a link to the message and indicate which forum they came from +
+ +For improved functionality you should upgrade to the latest version of +ACS 4.1 and the latest version of ACS Messaging (as of 2/13/01 4.1.1 +NOT included in ACS 4.1).

+ +For more details on bugfixes and improvements, visit the bboard +section of the ArsDigita +SDM.

+ +Note: This documentation has not been reviewed and is +not considered up to standards. More comprehensive and more refined +documentation will be available in an upcoming point release. If you +have further questions, feel free to ask on the applications +bboard.

+ + +

Overview

+ +BBoard implements a system for persistent asynchronous web based +discussions. A BBoard instance as configured from ACS-Admin can +contain some number for discussion forums. Each forums provides a +context for users with appropriate access to read and post messages. +Messages may optionally be tagged in a list categories to facilitate +sorting and searching. + +

Installation

+ +Using bboard requires an operating ACS 4.0.1 installation. If you +haven't upgraded, do so first! Installing and enabling the bboard +package should be relatively painless: just go to your server's +/acs-admin/apm/package-load page and enter +"http://www.arsdigita.com/acs-repository/download/apm/bboard-4.0.2r1.apm". +If you're reading this on your own server, you've already done +this.

+ +Once the package is installed and enabled, a subsite administrator can +then mount instances on their subsite. If you're the lone +über-admin of your site, you can just go to your site's +/admin/site-nodes/ page and create a new subfolder under the "/" +directory. Pick a creative label for your subfolder like "bboard" or +"dg". Select "new application" for that subfolder, and choose BBoard +from the pulldown menu. It is probably best to label the application +instance the same as your subfolder; do otherwise if it helps you keep +your site straight.

+ +At this point you should have a BBoard instance mounted in the +subfolder directory, let's say you chose "/bboard". Before delving +into configuration, let's run over BBoard's permissions model. + +

Initial Configuration

+ +Once mounted, you can surf over to /bboard as an administrator, create +some forums, and start discussing that crazy U.S. election! + +The following parameters are configurable on a package instance basic from the +appropirate node in /admin/site-nodes/. + +
+ +
ThreadingEnabledP + +
This enables or disables threading indentation on a single thread +basis. "t" enables threading and "f" (the default) turns it off. + +
MailFriendEnabledP + +
This enables the option for users to mail copies of a bboard +posting to a friend (or themselves). Since this functionality can be +abused, consider disabling the functionality. + +
UserPostsEditableP + +
This grants users privileges to edit their own message. Note: +toggling this parameter will not change the ability of user to edit +existing messages. This parameter only effects whether users are +granted rights to edit at the message's posting time. This must be +enabled for attachments to work. + +
AttachmentsEnabledP + +
This lets users who have edit capability on a message upload file +or image attachments. + +
MaxAttachmentSize + +
This specifies the maximum size in bytes to accept for binary +attachments. The default is 1 megabyte. + +
DisplayLastNDays + +
This parameter controls how many days worth of recent messages are +displayed on the forum overview page by default. 0 specifies +that all messages should be displayed. + +
+ +

Advanced Configuration and Permissions Overview

+ +The ACS 4.0 permissions system is about hierarchies and in particular +hiearchical containment. There are three important hiearchies: the +user hierarchy (users, groups, and parties), the object hierarchy +(objects nested in the contexts of others), and the privilege hiearchy +(privileges can entail other entails). This complexity of mechanism +is designed to allow for simplicity of use for programmers and +administrators. Unfortunately, interfaces to facilitate this +simplicity of use are not here yet. Until then, sophisticated control +and configuration of BBoard necessitates an understanding of these +details.

+ +The first hierarchy is straightforward. There are users and groups +(or together parties). Privileges granted to groups inherit to their +members.

+ +Unless explicitly disabled (see below), privileges granted to parties +are inherited down an object hierarchy. The nature of the BBoard +hierarchy is as follows: subsites contain bboard package instances; +bboard package instances contain forums; forums contain both +categories and messages. Privileges granted to parties on the package +instance are inherited to all the forums nested within and so on.

+ +The third hiearchy is the least clear. Privileges can be nested into +other privileges. This lets us group related privileges like those +for reading a message and reading a forum together to allow us to +easily grant "read access" on a hiearchy of objects to a party even +though there are separate notions of "read a message" and "read a +forum". All the bboard privileges are nested in one of the following +system level "super"-privileges: "read", "write", "create", "delete", +and "admin".

+ +The full set of self explanatory bboard privileges is listed here: +

    +
  • bboard_create_forum +
  • bboard_create_category +
  • bboard_create_message +
  • bboard_write_forum +
  • bboard_write_category +
  • bboard_write_message +
  • bboard_read_forum +
  • bboard_read_category +
  • bboard_read_message +
  • bboard_delete_forum +
  • bboard_delete_category +
  • bboard_delete_message +
  • bboard_moderate_forum +
+ + +Permissions on package instances are controlled through the "set +permissions" options on the appropriate folder in the admin site map +(/admin/site-map/). While in principal, the system should allow you +to grant permissions on lower level objects like forums or even +individual messages and categories, right now the UI is limited to +granting permissions on the application instance. SQL*Plus users or +even URL hackers can probably figure out how to do this if they're so +inclined.

+ +The default set of permissions granted in a bboard system are those +inherited from the main site: + +

    +
  • Registered Users have bboard_create_message +
  • The Public has bboard_read_category +
  • The Public has bboard_read_forum +
  • The Public has bboard_read_message +
  • The Public has read +
  • [Admin user] admin +
+ +Granting additional privileges to parties is fairly straightforward. +For moderated forums, creating a moderators group and granting them +"bboard_moderate_forum" (or "admin" if you're feeling lucky) will let +you delegate more of the discussion culling.

+ +For significantly different configurations you might need to revoke +privileges already granted by the defaults. In this case you must +configure the package instance not to inherit permissions from the +main site and then add back any permissions needed. Granting "read" +to registered users and bboard_create_message to "Elite d00ds" will +give you a pseudo-private forum.

+ +Note: To facilitate usability in the common case, BBoard pages present +the option to post or reply even if the user doesn't have the +bboard_create_message privilege. If you remove posting ability from +registered users, you may wish to alter the templates to appropriately +display options.

+ +

Miscellaneous Notes

+ +Text searching requires the maintaince of the content repository +cr_rev_content_index index; either by hand or by +context.

+ +As usual, please file bugs and feature requests in the bboard +SDM. + +

Engineering Documentss

+ + +
+
akk@arsdigita.com
+ Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/requirements.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/requirements.html,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/requirements.html 28 Aug 2003 09:41:51 -0000 1.5 @@ -0,0 +1,361 @@ + + + + Bulletin Board Requirements + + + +

Bulletin Board Requirements

+ by Anukul Kapoor, Pete Su, and Mark Thomas +
+ +

I. Introduction

+ +

This document outlines necessary functionality and behavior of + the new ACS 4.0 Bulletin Board system (herein referred to as bboard). + +

Our intent (as of 8/2000) is to start with a simple + implementation that can accomodate future advanced functionality. + As a result, these requirements may not prescribe functionality + present in the ACS 3.4 bboard system. We are using the + uslaw-bboard module as inspiration for a lightweight + implementation. + +

Futhermore, this document is conservative in attempting to + describe the ultimate framework for modular web based messaging. + We hope such an architecture may well be born out of iterative + process when designing this system. However, the scope is being + primarily limited to functional requirements. + +

The future requirements (section VII) should inform the design + process if not initially implemented. + +

II. Vision Statement

+ +

An electronic bulletin board system is one of the simplest and + most effective forms of collaboration between people separated in + space and time. Bboards provide a centralized and shared venue + for discussion that save communication costs over ad-hoc + mechanisms (like arbitrary email lists). Since messages are + organized by topic as well as temporally, bboard can provide + lightweight interfaces for rapidly navigating to interesting + messages. This low barrier to participation encourages + spontaneous collaboration between disperse parties in the + community. + +

The bboard system also serves as a useful archive and ad-hoc + knowledge management tool by virtue of its persistence, light + weight organizational structure, and flexible browse and search + facilities. This sort of knowledge base can be easily leveraged + to provide long term pedagogical value as well as aid in future + problem solving. + +

When integrated with an email system, bboards radically improve + email based collaboration. Email notifications can encourage + continuous awareness of community issues. Email based reply + functionality further lowers the barrier to participation, + encouraging more Interaction around the TransactionTM. + +

III. System/Application Overview

+ +

The bboard system allows users to browse, read, and + post messages organized into forums. Messages consist of short + text messages with optional attachments such as image files or + html documents. Messages are organized into threads when users + reply to each other, maintaining the temporal flow of a particular + discussion. + +

Forums are contexts for discussion relating to a particular + domain of interest. Examples include the photo.net Q&A forum, the + ArsDigita Web/DB forum, and the away.com discussion forum. + Messages within a particular forum can optionally be tagged as + being in certain categories to assist searching and navigation. + Forums are always created in the context of a subsite. + +

IV. Use-cases and User Scenarios

+ +

Administrator: Phillis Goodsport is a world famous + lithographer who wants to share her knowledge about lithography + and encourage interaction between a community of lithographers on + her new site litho.net. Although she likes the idea of a broad + forum for general lithography discussion, she wants browsing to be + tractable when traffic increases. If quality goes down, she'd + like to dedicate one of her minions to moderating traffic to + maintain her high standards. + +

Casual browser and poster: Joe Schmoe goes to photo.net + for the first time and wants to ask what zoom lens to buy. He + needs to find the appropriate category/topic to post his message. + +

Compulsive reader and expert poster: Jane Developer is a + web development guru and wants to keep up with as much of the + traffic on the web/db forum as possible. She wants to become + aware of posts that might become relevant to her in the future + as well as help out folks who have problems she knows how to + solve. Since Jane is on lots of developer mailing lists, her + preferred form of interaction is via email. + +

Moderator: Dave Balderdash is a chatter.net moderator and + wants to delete redundant or useless posts. He's short + on time, so he wants a quick interface for rejecting and approving + posts. + +

Targeted researcher: Ted Stetson is an ACS developer who + remembers someone mentioning something about his Oracle problem on + a bboard. He wants to find records of similar problems and any + related solutions. + +

V. Related Links

+ +
    +
  • Design Document (not available) +
  • Test Plan (not available) +
  • Subcommunities + +
+ + +

VI.A Requirements: User Interface

+

End User Basics

+ +

10.10.10 The bboard system must provide + mechanism for users to effectively choose which messages to read + within a forum. Bboard must provide an overview interface to + enable users to find messages of interest or relevant to them. + This overview should provide the user with cursory information to + facilitate quick scanning and meaningful evaluation of message + contents. + +

10.10.15 The full text of bboard messages + should be searchable by user queries. + +

10.10.20 [unimplemented] Bboard should consistently provide + a mechanism to limit or sort displayed posts by categories, posters, + and date range as well as to perform a text search. + +

10.10.30 [unimplemented] Most users primarily want + to browse and read new posts or replies since their last visit. + The bboard interface must allow users to ignore messages they've + already read. + +

10.10.40 [unimplemented] Users should be able to search within + and limit scope to messages they have already read as well as + messages they have not read at all. + +

10.10.50 Users must be able to easily post new + messages to a bboard, or reply to existing messages they have come + across. When replying, users must be presenting with enough + context to assist their composition. + +

Email Integration

+ +

10.20.10 Users can register for email + notification of new messages in a particular forums. + +

10.20.13 Users can register for email + notifications on a particular thread. + +

10.20.16 Users can register for email + notifications on a particular category. + +

10.20.20 [unimplemented] Notifications can be sent as each + message arrives or in an organized digest form over a configurable + time period. + +

10.20.30 Individual messages will have appropriate RFC 822 + headers to enable threading in the mail client. + +

10.20.40 [unimplemented] + Email from the alert system should be tagged in the + header with the site and forum name to enable easy filtering in + mail clients. Well, as easy as the mail clients make it anyway. + +

10.20.50 [unimplemented] + If the user requests it, email generated should use MIME + encoding to deliver attachements and appropriately encode HTML. + Otherwise plain text emails should be augmented with URLs and + styling cues in place of rich content. + +

Administrative Requirements

+ +

10.30.10 The bboard system must support a + flexible presentation layer that allows custom layout of bboard + content. + +

10.30.15 Publishers should have the option of + displaying discussions in a flat linear fashion or in an indented + threaded view. + +

10.30.20 Parties with administrative + privileges on a particular subsite can create, delete, and edit + forums scoped to that subsite. + +

10.30.30 Forums can be designated moderated in + which case parties with sufficient privileges must approve + messages before they are displayed generally. + +

Access Control Requirements

+ + Objects must be structured to allow the flexible configuration and + assignment of the following privileges: + +

10.40.10 Reading forums + +

10.40.20 Reading messages + +

10.40.30 Posting new messages + +

10.40.50 Approving and rejecting posted messages + (for moderated groups) + +

10.40.60 Managing the forum (editing title and + description, determining moderation and restriction policies, + granting approval privileges to others, banning users) + +

10.40.70 Managing categories (editing, deleting, + combining categories) + +

VI.B Requirements: Datamodel

+ +

Messages

+ +

10.80.10 Messages are the basic units of the + bboard module. The bboard system will provide a repository to + store text messages. + +

10.80.20 Messages will be tagged as having + HTML, plain text, or preformatted text in their body. + +

10.80.30 Messages will have a brief plain text + subject line. + +

10.80.40 Messages will be related to their + creating user. + +

10.80.50 Messages may optionally have + binary attachments. + +

10.80.60 The bboard system must store relations + between messages and their replies to enable threaded views. + +

Forums

+ +

10.90.10 Forums are the main administrative + units of the bboard system. Forums are containers to which + messages uniquely belong. + +

10.90.20 Forums must have a brief text + descriptions and optionally a longer description called a charter. + +

Categories

+ +

10.100.10 There must be a mechanism for + intra-forum categorization to facilitate filter, searching, and + tractability. + +

VI.C Requirements: API

+ + No requirements in this section are met by the + current implementation. + +

Since bboard is primarily an end user application any exposed + APIs will come out of the design rather than nailed down + requirements from the start. Stay tuned. + +

VI.D Possible Future Requirements

+ +

10.255.10 bboard should provide a framework + for extending the generic messaging repository with meta-data + and in tandem extending the user interface to take advantage of + this meta-data. This would let developers properly layer + functionality such as geo-spatial messaging and slashdot style + scoring. This is actually provided via ACS messaging and the ACS + Object system. + +

10.255.20 bboard should support replying to + and initiating threads from email. Administrative email list + functionality should be developed or integrated. + +

10.255.30 Bboard should let users register + interests (categories, certain users, keywords) for the purpose of + filtering and sorting message displays. + +

10.255.40 Users should have the option of + enabling spell checking on their posts. A framework for filtering + (removing bad words, promoting text URLs to html links, auto + detecting HTML vs. plain text, etc.,) should exist. + +

10.255.50 Allow users to configure how big the + textareas editing widgets they get are. + +

10.255.60 Moderators should be given the + option of making notes on a given discussion that appear + prominently in the discussion display. + +

10.255.70 Moderators should be able to set + posts to expire at a configurable time in the future. + +

10.255.80 Mega bonus points: an nntp gateway to + bboards for access from standard news clients. + +

10.255.90 The bboard system should be able to + take advantage of a caching system that stores the results of + database queries for optimal scalability. + +

10.255.100 Publishers should have the option + of allowing users to edit various parts of messages after they are + posted (e.g. the text body, the subject, the text presentaiton + style etc.,) + +

10.255.110 A user interface should allow + administrators to easily categorize or recategorize existing + messages. + +

10.255.120 Publishers should be able to + classify users based on their forum contributions and + appropriately target them for email, promotions, etc., + +

10.255.130 Explicit permissions for posting + new messages vs. posting replies. + +

10.255.140 Explicit permissions for posting + attachments. + +

Performance requirements

+ +

VII. Revision History

+ + + + + + + + + + + + + + + + + + + + + + + + +
Document Revision #Action Taken, NotesWhen?By Whom?
0.1Creation08/23/2000Anukul Kapoor
0.2Revision: More standard style, more detailed requirements.08/24/2000Anukul Kapoor
+ +
+
+Last modified: $Id: requirements.html,v 1.5 2003/08/28 09:41:51 lars Exp $ + + Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/configuration.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/configuration.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/configuration.xml 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,116 @@ + +Advanced Configuration + + +The ACS 4.0 permissions system is about hierarchies and in particular +hiearchical containment. There are three important hiearchies: + + + + +the user hierarchy (users, groups, and parties) + + + +the object hierarchy (objects nested in the contexts of others) + + + +the privilege hiearchy (privileges can entail other entails). + + + + +This complexity of mechanism is designed to allow for +simplicity of use for programmers and administrators. Unfortunately, +interfaces to facilitate this simplicity of use are not here yet. Until then, +sophisticated control and configuration of BBoard necessitates an +understanding of these details. + + +The first hierarchy is straightforward. There are users and groups (or +together parties). Privileges granted to groups inherit to their members. + +Unless explicitly disabled (see below), privileges granted to parties are +inherited down an object hierarchy. The nature of the BBoard hierarchy is as +follows: subsites contain bboard package instances; bboard package instances +contain forums; forums contain both categories and messages. Privileges +granted to parties on the package instance are inherited to all the forums +nested within and so on. + +The third hiearchy is the least clear. Privileges can be nested into other +privileges. This lets us group related privileges like those for reading a +message and reading a forum together to allow us to easily grant "read +access" on a hiearchy of objects to a party even though there are +separate notions of "read a message" and "read a forum". +All the bboard privileges are nested in one of the following system level +"super"-privileges: "read", "write", +"create", "delete", and "admin". + +The full set of self explanatory bboard privileges is listed here: + + +bboard_create_forum +bboard_create_category +bboard_create_message +bboard_write_forum +bboard_write_category +bboard_write_message +bboard_read_forum +bboard_read_category +bboard_read_message +bboard_delete_forum +bboard_delete_category +bboard_delete_message +bboard_moderate_forum + + + + +Permissions on package instances are controlled through the "set +permissions" options on the appropriate folder in the admin site map +(/admin/site-map/). While in principal, the system should allow you to grant +permissions on lower level objects like forums or even individual messages +and categories, right now the UI is limited to granting permissions on the +application instance. SQL*Plus users or even URL hackers can probably figure +out how to do this if they're so inclined. + + +The default set of permissions granted in a bboard system are those +inherited from the main site: + + +Registered Users have bboard_create_message + +The Public has bboard_read_category + +The Public has bboard_read_forum + +The Public has bboard_read_message + +The Public has read + +[Admin user] admin + + + +Granting additional privileges to parties is fairly straightforward. For +moderated forums, creating a moderators group and granting them +"bboard_moderate_forum" (or "admin" if you're feeling +lucky) will let you delegate more of the discussion culling. + + +For significantly different configurations you might need to revoke +privileges already granted by the defaults. In this case you must configure +the package instance not to inherit permissions from the main site and then +add back any permissions needed. Granting "read" to registered +users and bboard_create_message to "Elite d00ds" will give you a +pseudo-private forum. + +Note: To facilitate usability in the common case, BBoard pages present the +option to post or reply even if the user doesn't have the +bboard_create_message privilege. If you remove posting ability from +registered users, you may wish to alter the templates to appropriately +display options. + + \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/design.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/design.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/design.xml 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,352 @@ + +ACS Messaging & BBoard Design Document + + + +Essentials + + + +User directory: /bboard/ + + + +Data model: bboard-create.sql + + +acs-messaging-create.sql + +Data-model diagram + + + + + +Introduction + + +bboard is an ACS application package built to provide +scalable discussion forums to a community of users. As in older versions, +bboard provides: + + +posting, browsing, and reading of messages in discussion forums + +tools for moderators to maintain editorial standards + +categorization and retrieval for knowledge management + + + +The initial 4.0 implementation adds the following new features: + + + +fully templated presentation layer for easy customization + +improved access control on bboard operations to support a wide variety of +publisher policies + +support for multiple distinct configurations of the bboard package (e.g. +different forums and options at http://foo.com/bboard/ and +http://foo.com/pittsburgh/bboard/) + + + + + + +The ACS 4.0 version of bboard is a re-engineering of the data +model and presentation layer without certain capabilities present in the ACS +3.4 bboard. In future releases we intend to achieve the same level of +maturity as the older bboard while building on the flexibility +of the new design. + + +In particular this implementation (9/2000) does not include the following +features found in prior versions: + + + +support for expiring messages + +facilities for spamming dynamic classes of bboard users + +bboard messages with rich media attachments + +email alert functionality + +full text messages searching + + +bboard is not intended to be the ultimate +customizable web based discussion system. It is intended to be a practical +and useful system that supports forums much like the photo.net Q&A forum. +Publishers with special needs are encouraged to implement their solution as a +module, much like bboard, built atop the framework acs-messaging +provides. + +acs-messaging is a general purpose component that provides +threaded messaging services to higher level applications such as +bboard. The motivation is to provide a base level data model and +reusable presentation code that enables the rapid customization of messaging +applications. acs-messaging is intended to simplify modules like +general comments and webmail, as well as +specialized messaging applications such as scorecard's geospatial bboard. Such +a framework keeps custom organizational metadata, pageflow and navigation, +and publishing and moderation policy separate from the basic tools needed for +discussion. + + + + +Historical Considerations + + +Over the course of ACS development, bboard has grown to +encompass a wide variety of functionality. Much of this functionality was +developed first for bboard and only later adapted into more +general mechanisms (e.g. alerts, security, group scoping, etc.,). However +bboard wasn't refactored to take advantage of the more +general facilities, and its complexity challenged those in need of custom +features. Furthermore there was a lot of ad hoc mechanism in both the data +model and page flow to support different presentation styles, navigation +schemes, and access control models. Although this bboard proved +to be useful, scalable, and reliable, the ability to maintain and extend this +code suffered. + + + +The ACS 4.0 release of bboard mimics the basic functionality of older +bboard versions but built atop new ACS 4.0 general mechanisms +(objects, persmissions, templating, acs-messaging, etc.,). + + + + + +Competitive Analysis + + +An analysis of the bboard feature space should be added here. + + + +USENET a la gnus + +slashdot + +Userland + +???? + + + + + +Design Tradeoffs + + +How does one reconcile all the possible discussion forums mentioned above +into a single module? One does not! bboard is precisely one way +to implement a discussion forum and should not be all things. In time, there +should be a toolkit of components (user interface, data model, and +procedural) for developers to assemble their custom. + +Although many of the entities in the data model are implemented as +subtyples of ACS object, we avoid using information from the ACS object table +for anything but auditing purposes. For example, we could store a +message's author in the ACS object creation_user field, however to keep +query performance in line we rather use the author field in acs_messages. + + + + +API + + +As of the initial ACS 4.0 release, acs-messaging and +bboard do not provide well defined programming interfaces. + +Although convenience functions will be provided for basic transactions on +the acs-messaging and bboard entities, it remains +to be seen what sort of abstraction layer is most appropriate. + + + + +Data Model Discussion + + +acs-messaging defines the view acs_messages_all +for the storage and access of threaded text messages and assorted information +relevant to their display, access, and creation. Under the covers +acs-messaging use the content repository for underlying +storage. + +bboard uses acs-messaging messages, and +organizes them into forums and categories. For the purposed of the ACS +permissions system, forums contain messages, and so any permissions on a +forum will default to being inherited for individual messages. + +A forum may be designated as moderated, in which case explicit approvals +or denials are stored in the bboard_message_moderation. Messages +without entries in the moderation table are considered unseen, and will be +displayed or hidden in moderated forums based on policy. + +Each forum may have some number of categories, tags denoting further +specialization within a forum. Messages of a forum may be tagged as being in +any of the categories pertaining to that forum. + +Permissions + + +Permissions in ACS 4.0 involve 3 interrelated hierarchies: users & +groups, objects, and privileges. The user and group hiearchy is generally +explained elsewhere. The short explanation: + + +The long explanation: BBoard defines the following permissions: + + +nested under the create permission: + +bboard_create_forum + +bboard_create_category + +bboard_create_message + +nested under the write permission: + +bboard_write_forum + +bboard_write_category + +bboard_write_message + +nested under the read permission: + +bboard_read_forum + +bboard_read_category + +bboard_read_message + +nested under the delete permission: + +bboard_delete_forum + +bboard_delete_category + +bboard_delete_message + +nested under the moderate permission: + +bboard_moderate_forum + + + + + +User Interface + +... + + + + +Configuration/Parameters + +... + + + + +Acceptance Tests + +... + + + + +Future Improvements/Areas of Likely Change + + +Much of the functionality of the ACS content repository will eventually +provide tangible benefits to bboard and any +acs-messaging application. Foremost among these features will be +full text searching and rich media attachments. + +When ACS provides a general mechanism for an installation to send and +receive email, bboard can provide email alerts and email based +reply and post. + + + + +Authors + + +Anukul Kapoor + + + + + +Revision History + + + + + +Document Revision # +Action Taken, Notes +When? +By Whom? + + + + + + +0.2 +Revision +09/19/2000 +Anukul Kapoor + + + + +0.1 +Creation +09/01/2000 +Anukul Kapoor + + + + + + + + + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/index.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/index.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/index.xml 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + +]> + + +Bboard Documentation + + + + For Everyone + + + Overview + Brief introduction, support possibilities and release notes + + + &introduction; + &support; + + + + + + For Admins + + + Overview + Installation, maintenance + + + &installation; + &configuration; + + + + + For Developers + + + Overview + Requirements, design + + + &requirements; + &design; + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/installation.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/installation.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/installation.xml 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,185 @@ + +Installation and Configuration of Bboard + + +Installation + + +Using bboard requires an operating ACS 4.0.1 installation. If you haven't +upgraded, do so first. + + + +Installing and enabling the bboard package should be +relatively painless, just: + + + + +go to your server's +/acs-admin/apm/package-load +page, enter +"www.arsdigita.com/acs-repository/download/apm/bboard-4.0.2.apm" +in the first text box + + + + + +click the button and follow the instructions + + + + + +If you're reading this on your own server, you've +probably already done this. + + + +Once the package is installed and enabled, a subsite administrator can +mount instances on their subsite. If you're the +lone &uuml;ber-admin +of your site, you can just go to your site's +/admin/site-map/ page and: + + + + + +create a new subfolder under the "/" directory + + + +Pick a creative +label for your subfolder like "bboard" or "dgroup" + + + +Select +"new application" for that subfolder, and choose BBoard from the +pulldown menu. + + + + +It is probably best to label the application instance the same +as your subfolder; do otherwise if it helps you keep your site straight. + +At this point you should have a BBoard instance mounted in the subfolder +directory - for the rest of this document I assume that you've choosen "/bboard". + + + + + +Initial Configuration + + +Before you can start using the Bboard you have to create some forums: + + + + +log in as an administrator + + + +surf to /bboard and click "Create a forum" + + + + + +After you've created one or more forums you can specify the settings for your instance +of Bboard from the Site Map +(click set parameters). + + + +Most of the setting you see require a "t" (for true) or "f" (for false). +The rest should be self-explanatory. + + + + +ThreadingEnabledP + + + +This enables or disables threading indentation on a single thread basis. +"t" enables threading and "f" (the default) turns it +off. + + + +MailFriendEnabledP + + + +This enables the option for users to mail copies of a bboard posting to a +friend (or themselves). Since this functionality can be abused, consider +disabling the functionality. + + + +UserPostsEditableP + + + +This grants users privileges to edit their own message. Note: toggling +this parameter will not change the ability of user to edit existing messages. +This parameter only effects whether users are granted rights to edit at the +message's posting time. This must be enabled for attachments to +work. + + + +UserPostsDeletableP + + + +This grants users privileges to delete their own +message. Note: This parameter only effects whether users are granted +rights to edit their message's with the +UserPostsEditableP. + + + +AttachmentsEnabledP + + + +This lets users who have edit capability on a message upload file or +image attachments. + + + + +MaxAttachmentSize + + +This specifies the maximum size in bytes to accept for binary +attachments. The default is 1 megabyte. + + + + +DisplayLastNDays + + +This parameter controls how many days worth of recent messages are +displayed on the forum overview page by default. 0 specifies that all +messages should be displayed. + + + + +If you want to learn how to set more advanced parameters of your Bboard instance, +read . + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/intro.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/intro.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/intro.xml 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,21 @@ + +Bboard Introduction + + +What is Bboard? + + +BBoard is a web based discussion system for the ArsDigita Community +System. Once installed and mounted, bboard instances provide +locations on the site that contain discussion forums +(e.g. http://developer.arsdigita.com/bboard/). Users can post and +read messages within individual forums, which are generally geared +towards specific topics or audiences. This basic functionality is +supplemented with a variety of additional features including image and +file message attachments, email notification, categorization, and +moderation facilities. + + + + + \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/notes.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/notes.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/notes.xml 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,42 @@ + +Release Notes and Miscellaneous Stuff + + +Release Notes + + +This is the final release of BBoard 4.0.2. This release requires ACS +Core 4.0.1, available from the ACS Repository. + + +This version offers a working drop script, numerous bugfixes, and some +notable improvements such as: + + +support for binary attachments + +letting users email postings to others + +more informative displays + +performance improvements + + + + + + + + + +Miscellaneous Notes + + +Text searching requires the maintaince of the content repository +cr_rev_content_index index; either by hand or by context. + + + + + \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/requirements.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/requirements.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/requirements.xml 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,427 @@ + +Bulletin Board Requirements + + +By Anukul Kapoor, Pete Su and Mark Thomas + + + +Introduction + + +This document outlines necessary functionality and behavior of the new ACS +4.0 Bulletin Board system (herein referred to as bboard). + +Our intent (as of 8/2000) is to start with a simple implementation that +can accomodate future advanced functionality. As a result, these requirements +may not prescribe functionality present in the ACS 3.4 bboard system. We are +using the uslaw-bboard module as inspiration for a lightweight +implementation. + +Futhermore, this document is conservative in attempting to describe the +ultimate framework for modular web based messaging. We hope such an +architecture may well be born out of iterative process when designing this +system. However, the scope is being primarily limited to functional +requirements. + +The future requirements should inform the design process if +not initially implemented. + + + + +Vision Statement + + +An electronic bulletin board system is one of the simplest and most +effective forms of collaboration between people separated in space and time. +Bboards provide a centralized and shared venue for discussion that save +communication costs over ad-hoc mechanisms (like arbitrary email lists). +Since messages are organized by topic as well as temporally, bboard can +provide lightweight interfaces for rapidly navigating to interesting +messages. This low barrier to participation encourages spontaneous +collaboration between disperse parties in the community. + +The bboard system also serves as a useful archive and ad-hoc knowledge +management tool by virtue of its persistence, light weight organizational +structure, and flexible browse and search facilities. This sort of knowledge +base can be easily leveraged to provide long term pedagogical value as well +as aid in future problem solving. + +When integrated with an email system, bboards radically improve email +based collaboration. Email notifications can encourage continuous awareness +of community issues. Email based reply functionality further lowers the +barrier to participation, encouraging more Interaction around the +Transaction™. + + + + +System/Application Overview + + +The bboard system allows users to browse, read, and post messages +organized into forums. Messages consist of short text messages with optional +attachments such as image files or html documents. Messages are organized +into threads when users reply to each other, maintaining the temporal flow of +a particular discussion. + +Forums are contexts for discussion relating to a particular domain of +interest. Examples include the photo.net Q&A forum, the ArsDigita Web/DB +forum, and the away.com discussion forum. Messages within a particular forum +can optionally be tagged as being in certain categories to assist searching +and navigation. Forums are always created in the context of a subsite. + + + + +IV. Use-cases and User Scenarios + + +Administrator: Phillis Goodsport is a world famous +lithographer who wants to share her knowledge about lithography and encourage +interaction between a community of lithographers on her new site litho.net. +Although she likes the idea of a broad forum for general lithography +discussion, she wants browsing to be tractable when traffic increases. If +quality goes down, she'd like to dedicate one of her minions to +moderating traffic to maintain her high standards. + +Casual browser and poster: Joe Schmoe goes to photo.net +for the first time and wants to ask what zoom lens to buy. He needs to find +the appropriate category/topic to post his message. + +Compulsive reader and expert poster: Jane Developer is a +web development guru and wants to keep up with as much of the traffic on the +web/db forum as possible. She wants to become aware of posts that might +become relevant to her in the future as well as help out folks who have +problems she knows how to solve. Since Jane is on lots of developer mailing +lists, her preferred form of interaction is via email. + +Moderator: Dave Balderdash is a chatter.net moderator and +wants to delete redundant or useless posts. He's short on time, so he +wants a quick interface for rejecting and approving posts. + +Targeted researcher: Ted Stetson is an ACS developer who +remembers someone mentioning something about his Oracle problem on a bboard. +He wants to find records of similar problems and any related solutions. + + + + +Related Links + + + + + +Test Plan (not available) + + +notes on USLaw-BBoard implementation + +Subcommunities + +Karl's +thoughts on bboard redesign + +Adam +Farkas's web/db thread on bboard improvements + + + + + +Requirements: User Interface + + + +10.10 End User Basics + +
+10.10.10 The bboard system must provide mechanism for +users to effectively choose which messages to read within a forum. Bboard +must provide an overview interface to enable users to find messages of +interest or relevant to them. This overview should provide the user with +cursory information to facilitate quick scanning and meaningful evaluation of +message contents. + +10.10.15 The full text of bboard messages should be +searchable by user queries. + +10.10.20 [unimplemented] Bboard +should consistently provide a mechanism to limit or sort displayed posts by +categories, posters, and date range as well as to perform a text search. + +10.10.30 [unimplemented] Most +users primarily want to browse and read new posts or replies since their last +visit. The bboard interface must allow users to ignore messages they've +already read. + +10.10.40 [unimplemented] Users +should be able to search within and limit scope to messages they have already +read as well as messages they have not read at all. + +10.10.50 Users must be able to easily post new messages +to a bboard, or reply to existing messages they have come across. When +replying, users must be presenting with enough context to assist their +composition. +
+
+ + +10.20 Email Integration + +
+10.20.10 Users can register for email notification of new +messages in a particular forums. + +10.20.13 Users can register for email notifications on a +particular thread. + +10.20.16 Users can register for email notifications on a +particular category. + +10.20.20 [unimplemented] +Notifications can be sent as each message arrives or in an organized digest +form over a configurable time period. + +10.20.30 Individual messages will have appropriate RFC +822 headers to enable threading in the mail client. + +10.20.40 [unimplemented] Email +from the alert system should be tagged in the header with the site and forum +name to enable easy filtering in mail clients. Well, as easy as the mail +clients make it anyway. + +10.20.50 [unimplemented] If the +user requests it, email generated should use MIME encoding to deliver +attachements and appropriately encode HTML. Otherwise plain text emails +should be augmented with URLs and styling cues in place of rich content. +
+
+ + +10.30 Administrative Requirements + +
+10.30.10 The bboard system must support a flexible +presentation layer that allows custom layout of bboard content. + +10.30.15 Publishers should have the option of displaying +discussions in a flat linear fashion or in an indented threaded view. + +10.30.20 Parties with administrative privileges on a +particular subsite can create, delete, and edit forums scoped to that +subsite. + +10.30.30 Forums can be designated moderated in which case +parties with sufficient privileges must approve messages before they are +displayed generally. +
+
+ + +10.40 Access Control Requirements + +
+Objects must be structured to allow the flexible configuration and assignment +of the following privileges: + +10.40.10 Reading forums + +10.40.20 Reading messages + +10.40.30 Posting new messages + +10.40.50 Approving and rejecting posted messages (for +moderated groups) + +10.40.60 Managing the forum (editing title and +description, determining moderation and restriction policies, granting +approval privileges to others, banning users) + +10.40.70 Managing categories (editing, deleting, +combining categories) +
+
+
+ +
+ + +Requirements: Data-model + + + +20.10 Messages + +
+20.10.10 Messages are the basic units of the bboard +module. The bboard system will provide a repository to store text +messages. + +20.10.20 Messages will be tagged as having HTML, plain +text, or preformatted text in their body. + +20.10.30 Messages will have a brief plain text subject +line. + +20.10.40 Messages will be related to their creating +user. + +20.10.50 Messages may optionally have binary +attachments. + +20.10.60 The bboard system must store relations between +messages and their replies to enable threaded views. +
+
+ + +20.20 Forums + +
+20.20.10 Forums are the main administrative units of the +bboard system. Forums are containers to which messages uniquely belong. + +20.20.20 Forums must have a brief text descriptions and +optionally a longer description called a charter. +
+
+ + +20.30 Categories + +
+20.30.10 There must be a mechanism for intra-forum +categorization to facilitate filter, searching, and tractability. +
+
+
+
+ + +Requirements: API + + +No requirements in this section are met by the current +implementation. + +Since bboard is primarily an end user application any exposed APIs will +come out of the design rather than nailed down requirements from the start. +Stay tuned. + + + + +Possible Future Requirements + + + +40.10 In no particular order + +
+40.10.10 bboard should provide a framework for extending +the generic messaging repository with meta-data and in tandem extending the +user interface to take advantage of this meta-data. This would let developers +properly layer functionality such as geo-spatial messaging and slashdot style +scoring. This is actually provided via ACS messaging and the ACS Object +system. + +40.10.20 bboard should support replying to and +initiating threads from email. Administrative email list functionality should +be developed or integrated. + +40.10.30 Bboard should let users register interests +(categories, certain users, keywords) for the purpose of filtering and +sorting message displays. + +40.10.40 Users should have the option of enabling spell +checking on their posts. A framework for filtering (removing bad words, +promoting text URLs to html links, auto detecting HTML vs. plain text, etc.,) +should exist. + +40.10.50 Allow users to configure how big the textareas +editing widgets they get are. + +40.10.60 Moderators should be given the option +of making notes on a given discussion that appear prominently in the +discussion display. + +40.10.70 Moderators should be able to set posts to +expire at a configurable time in the future. + +40.10.80 Mega bonus points: an nntp gateway to bboards +for access from standard news clients. + +40.10.90 The bboard system should be able to take +advantage of a caching system that stores the results of database queries for +optimal scalability. + +40.10.100 Publishers should have the option of allowing +users to edit various parts of messages after they are posted (e.g. the text +body, the subject, the text presentaiton style etc.,) + +40.10.110 A user interface should allow administrators +to easily categorize or recategorize existing messages. + +40.10.120 Publishers should be able to classify users +based on their forum contributions and appropriately target them for email, +promotions, etc., + +40.10.130 Explicit permissions for posting new messages +vs. posting replies. + +40.10.140 Explicit permissions for posting +attachments. +
+
+ + +40.20 Performance requirements + +
+ +
+ + +Revision History + + + + + + + + +Document Revision # +Action Taken, Notes +When? +By Whom? + + + + + +0.2 +Revision: More standard style, more detailed requirements. +08/24/2000 +Anukul Kapoor + + + + +0.1 +Creation +08/23/2000 +Anukul Kapoor + + + + + + + + +
+ Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/support.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/support.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/support.xml 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,57 @@ + +Support + + +There's a couple of different places you can turn to if this documentation +comes short of answers to your questions or if you want to give us +feedback: + + + + + +If you have a general question about usage of the application + + + +Ask on the +applications bboard at arsdigita.com. + + + + + +If you want to report a bug or keep up-to-date on bug fixes + + + +Visit the +ArsDigita SDM. + + + + + +If you are interested in the general status of the Bboard application + + + +Up to date info on BBoard is available from the BBoard status +page. + + + + + +If you have questions, comments or suggestions to this documentation + + + +Visit the Documentation Central +or fire directly at acs-docs@ardigita.com. + + + + + + \ No newline at end of file Index: openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/top.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/top.xml,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard/www/doc/xml/top.xml 28 Aug 2003 09:41:51 -0000 1.3 @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + +]> + + +Bboard Documentation + + + + For Everyone + + + Overview + Brief introduction, support possibilities and release notes + + + &introduction; + &support; + ¬es; + + + + + + For Admins + + + Overview + Installation, maintenance + + + &installation; + &configuration; + + + + + For Developers + + + Overview + Requirements, design + + + &requirements; + &design; + + + + Index: openacs-4/contrib/obsolete-packages/bboard-portlets/bboard-portlets.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/bboard-portlets.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/bboard-portlets.info 28 Aug 2003 09:41:52 -0000 1.5 @@ -0,0 +1,39 @@ + + + + + Bboard portlets + Bboard portlets + f + t + + + + oracle + postgresql + + Phong Nguyen + Creates bboard datasources for portal portlets. + ArsDigita Corporation + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard-portlets/sql/oracle/bboard-portlets-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/sql/oracle/bboard-portlets-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/sql/oracle/bboard-portlets-create.sql 28 Aug 2003 09:41:52 -0000 1.3 @@ -0,0 +1,31 @@ +-- +-- packages/bboard-portlet/sql/bboard-portlets-create.sql +-- + +-- Creates bboard datasources for portal portlets + +-- Copyright (C) 2001 ArsDigita Corporation +-- @author Phong Nguyen (phong@arsdigita.com) +-- @creation-date 2001-02-26 + +-- $Id: bboard-portlets-create.sql,v 1.3 2003/08/28 09:41:52 lars Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License. Full text of the license is available from the GNU Project: +-- http://www.fsf.org/copyleft/gpl.html + +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id := portal_datasource.new( + data_type => 'raw', + package_key => 'bboard', + mime_type => 'application/x-ats', + name => 'Summarize bboard applications', + description => 'Summarizes the bboard topics for all instances of bboard mounted below the current node', + content_varchar => '/packages/bboard-portlets/www/summarize', + configurable_p => 'f' + ); +end; +/ +show errors Index: openacs-4/contrib/obsolete-packages/bboard-portlets/sql/oracle/bboard-portlets-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/sql/oracle/bboard-portlets-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/sql/oracle/bboard-portlets-drop.sql 28 Aug 2003 09:41:52 -0000 1.3 @@ -0,0 +1,37 @@ +-- +-- packages/bboard-portlets/sql/bboard-portlets-drop.sql +-- + +-- Drops bboard datasources for portal portlets + +-- Copyright (C) 2001 ArsDigita Corporation +-- @author Michael Bryzek (mbryzek@arsdigita.com) +-- @creation-date 2001-02-26 + +-- $Id: bboard-portlets-drop.sql,v 1.3 2003/08/28 09:41:52 lars Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License. Full text of the license is available from the GNU Project: +-- http://www.fsf.org/copyleft/gpl.html + +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + + begin + select datasource_id into ds_id + from portal_datasources + where name = 'Summarize bboard applications' + and package_key = 'bboard'; + exception when no_data_found then + ds_id := null; + end; + + if ds_id is not null then + portal_datasource.delete(ds_id); + end if; + +end; +/ +show errors; + Index: openacs-4/contrib/obsolete-packages/bboard-portlets/sql/postgresql/bboard-portlets-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/sql/postgresql/bboard-portlets-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/sql/postgresql/bboard-portlets-create.sql 28 Aug 2003 09:41:52 -0000 1.3 @@ -0,0 +1,20 @@ +-- +-- packages/bboard-portlet/sql/bboard-portlets-create.sql +-- + +-- Creates bboard datasources for portal portlets + +-- Copyright (C) 2001 ArsDigita Corporation +-- @author Phong Nguyen (phong@arsdigita.com) +-- @creation-date 2001-02-26 + +-- $Id: bboard-portlets-create.sql,v 1.3 2003/08/28 09:41:52 lars Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License. Full text of the license is available from the GNU Project: +-- http://www.fsf.org/copyleft/gpl.html + +select portal_datasource__new(NULL, 'raw', 'application/x-ats', NULL, 'Summarize bboard applications', + 'Summarizes the bboard topics for all instances of bboard mounted below the current node', + 'f', '/packages/bboard-portlets/www/summarize', 'bboard', 'portal_datasource', + current_timestamp, NULL, NULL, NULL); Index: openacs-4/contrib/obsolete-packages/bboard-portlets/sql/postgresql/bboard-portlets-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/sql/postgresql/bboard-portlets-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/sql/postgresql/bboard-portlets-drop.sql 28 Aug 2003 09:41:52 -0000 1.3 @@ -0,0 +1,37 @@ +-- +-- packages/bboard-portlets/sql/bboard-portlets-drop.sql +-- + +-- Drops bboard datasources for portal portlets + +-- Copyright (C) 2001 ArsDigita Corporation +-- @author Michael Bryzek (mbryzek@arsdigita.com) +-- @creation-date 2001-02-26 + +-- $Id: bboard-portlets-drop.sql,v 1.3 2003/08/28 09:41:52 lars Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License. Full text of the license is available from the GNU Project: +-- http://www.fsf.org/copyleft/gpl.html + +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + + begin + select datasource_id into ds_id + from portal_datasources + where name = 'Summarize bboard applications' + and package_key = 'bboard'; + exception when no_data_found then + ds_id := null; + end; + + if ds_id is not null then + portal_datasource.delete(ds_id); + end if; + +end; +/ +show errors; + Index: openacs-4/contrib/obsolete-packages/bboard-portlets/tcl/bboard-portlets-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/tcl/bboard-portlets-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/tcl/bboard-portlets-procs.tcl 28 Aug 2003 09:41:52 -0000 1.4 @@ -0,0 +1,39 @@ +# /packages/bboard-portlets/tcl/bboard-portlets-procs.tcl + +ad_page_contract { + + Procedures to supports bboard portlets + + @author mbryzek@arsdigita.com + @creation-date 2001-03-01 + @cvs-id $Id: bboard-portlets-procs.tcl,v 1.4 2003/08/28 09:41:52 lars Exp $ +} + + +ad_proc bboard_portlets_mount_application { + { -object_id "" } + { -node_id "" } + { -package_id "" } +} { + Mounts a bboard application beneath the portal associated with + object_id. If no such portal exists, does nothing. This function is + used as a callback in the acs-subsite group callback system + + @author mbryzek@arsdigita.com + @creation-date Fri Feb 9 18:55:22 2001 + + @return The package id of the newly mounted package, or the empty + string if no package was mounted + +} { + if { [empty_string_p $object_id] } { + error "Object ID must be specified" + } + + # Find the node ID for the portal associated with this object + set node_id [portal_node_id_for_object $object_id] + if { [empty_string_p $node_id] } { + return "" + } + return [subsite::auto_mount_application -node_id $node_id bboard] +} Index: openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize-oracle.xql 28 Aug 2003 09:41:52 -0000 1.3 @@ -0,0 +1,26 @@ + + + + oracle8.1.6 + + + + + select b.forum_id, + b.short_name, + site_node.url(sn.node_id) as url, + acs_object.name(sn.object_id) as bboard_name + from bboard_forums b, + site_nodes sn, + apm_packages apm + where sn.object_id = b.bboard_id(+) + and sn.parent_id = :node_id + and sn.object_id = apm.package_id + and apm.package_key = 'bboard' + order by lower(bboard_name) + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize-postgresql.xql 28 Aug 2003 09:41:52 -0000 1.4 @@ -0,0 +1,24 @@ + + + + postgresql7.1 + + + + + select b.forum_id, + b.short_name, + site_node__url(sn.node_id) as url, + acs_object__name(sn.object_id) as bboard_name + from bboard_forums b left join site_nodes sn on (sn.object_id = b.bboard_id), + apm_packages apm + where sn.parent_id = :node_id + and sn.object_id = apm.package_id + and apm.package_key = 'bboard' + order by 4 + + + + + + Index: openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize.adp 28 Aug 2003 09:41:52 -0000 1.3 @@ -0,0 +1,21 @@ + Index: openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/obsolete-packages/bboard-portlets/www/summarize.tcl 28 Aug 2003 09:41:52 -0000 1.3 @@ -0,0 +1,34 @@ +# /packages/portal-creator/www/datasources/bboard/summarize.tcl + +ad_page_contract { + Summarizes all bboard applications mounted directly below this node + + @author Phong Nguyen (phong@arsdigita.com) + @creation-date 2001-02-26 + @cvs-id $Id: summarize.tcl,v 1.3 2003/08/28 09:41:52 lars Exp $ +} { +} -properties { + context_bar:onevalue +} + +set node_id [ad_conn node_id] + +# get all of the bboard packages mounted under this node +db_multirow bboard select_bboard { + select b.forum_id, + b.short_name, + site_node.url(sn.node_id) as url, + acs_object.name(sn.object_id) as bboard_name + from bboard_forums b, + site_nodes sn, + apm_packages apm + where sn.object_id = b.bboard_id(+) + and sn.parent_id = :node_id + and sn.object_id = apm.package_id + and apm.package_key = 'bboard' + order by lower(bboard_name) +} + +set subsite_url [site_node_closest_ancestor_package_url -package_key acs-subsite] + +ad_return_template Index: openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-create.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-create.sql 17 May 2003 12:45:36 -0000 1.4 +++ openacs-4/contrib/obsolete-packages/wf-ticket-tracker/sql/postgresql/wf-ticket-tracker-create.sql 28 Aug 2003 09:41:58 -0000 1.5 @@ -46,8 +46,8 @@ new__creation_user alias for $7; new__creation_ip alias for $8; v_creation_date timestamptz; - v_ticket_id number; - v_case_id number; + v_ticket_id integer; + v_case_id integer; begin if (new__creation_date is null) or (new__creation_date = 0) then v_creation_date = now(); Index: openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 17 May 2003 09:36:01 -0000 1.7 +++ openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 28 Aug 2003 09:41:37 -0000 1.8 @@ -12,24 +12,24 @@ Build a dynamic section dimensional slider. } { set sections [db_list apm_parameter_sections { - select distinct(section_name) - from apm_parameters - where package_key = :package_key + select distinct(section_name) + from apm_parameters + where package_key = :package_key }] if { [llength $sections] > 1 } { - set i 0 - lappend section_list [list $package_key $package_key [list "where" "section_name is null"]] - foreach section $sections { - incr i - if { ![empty_string_p $section] } { - lappend section_list [list "section_$i" $section [list "where" "section_name = '[db_quote $section]'"]] - } - } - lappend section_list [list all "All" [list] ] - return [list [list section_name "Section:" $package_key $section_list]] + set i 0 + lappend section_list [list $package_key $package_key [list "where" "section_name is null"]] + foreach section $sections { + incr i + if { ![empty_string_p $section] } { + lappend section_list [list "section_$i" $section [list "where" "section_name = '[db_quote $section]'"]] + } + } + lappend section_list [list all "All" [list] ] + return [list [list section_name "Section:" $package_key $section_list]] } else { - return "" + return "" } } @@ -46,17 +46,17 @@ set apm_url "/acs-admin/apm" if { [llength $args] == 0 } { - set title $apm_title + set title $apm_title set context_bar [ad_context_bar $title] } else { - set title [lindex $args end] + set title [lindex $args end] set context [concat [list [list $apm_url $apm_title]] $args] set context_bar [eval ad_context_bar $context] } set header [ad_header $title ""] append body "$header\n" if {![empty_string_p $form]} { - append body "
" + append body "" } return "$body\n @@ -70,132 +70,160 @@ set out "" set line_length 0 foreach element $cmd { - if { $line_length + [string length $element] > 72 } { - append out "\\\n " - set line_length 4 - } - append out "$element " - incr line_length [expr { [string length $element] + 1 }] + if { $line_length + [string length $element] > 72 } { + append out "\\\n " + set line_length 4 + } + append out "$element " + incr line_length [expr { [string length $element] + 1 }] } append out "\n" } -ad_proc -private apm_package_selection_widget {pkg_info_list {to_install ""} {to_enable ""}} { +ad_proc -private apm_package_selection_widget { + -install_enable:boolean + pkg_info_list + {to_install ""} + {to_enable ""} +} { Provides a widget for selecting packages. Displays dependency information if available. + + @param intall_enable Set this flag if you want separate install and enable checkboxes to be displayed. If you don't set it, + only the enable checkbox will be displayed, and the resulting page is expected to assume that enable also means install. } { if {[empty_string_p $pkg_info_list]} { - return "" + return "" } set checkbox_count 0 set counter 0 set band_colors { white "#ececec" } set widget "
- +[ad_decode $install_enable_p 1 "" ""] " foreach pkg_info $pkg_info_list { - - incr counter - set package_key [pkg_info_key $pkg_info] - set spec_file [pkg_info_spec $pkg_info] - array set package [apm_read_package_info_file $spec_file] - set version_name $package(name) - ns_log Debug "Selection widget: $package_key, Dependency: [pkg_info_dependency_p $pkg_info]" + + incr counter + set package_key [pkg_info_key $pkg_info] + set spec_file [pkg_info_spec $pkg_info] + array set package [apm_read_package_info_file $spec_file] + set version_name $package(name) + ns_log Debug "Selection widget: $package_key, Dependency: [pkg_info_dependency_p $pkg_info]" - append widget " " - if { ![string compare [pkg_info_dependency_p $pkg_info] "t"]} { - # Dependency passed. - if { ([lsearch -exact $to_install $package_key] != -1) } { - append widget " " - } else { - append widget " " - } - if { [lsearch -exact $to_enable $package_key] != -1 } { - append widget " - - - - - " - } elseif { ![string compare [pkg_info_dependency_p $pkg_info] "f"] } { - #Dependency failed. - append widget " " - append widget " - - - + append widget " " + if { ![string compare [pkg_info_dependency_p $pkg_info] "t"]} { + # Dependency passed. + + if { $install_enable_p } { + if { ([lsearch -exact $to_install $package_key] != -1) } { + append widget " " + } else { + append widget " " + } + } + if { [lsearch -exact $to_enable $package_key] != -1 } { + append widget " + + + + + " + } elseif { ![string compare [pkg_info_dependency_p $pkg_info] "f"] } { + #Dependency failed. + if { $install_enable_p } { + append widget " " + } + append widget " + + + - - " - } else { - # No dependency information. - # See if the install is already installed with a higher version number. - if {[apm_package_registered_p $package_key]} { - set higher_version_p [apm_higher_version_installed_p $package_key $version_name] - } else { - set higher_version_p 2 - } - if {$higher_version_p == 2 } { - set comment "New install." - } elseif {$higher_version_p == 1 } { - set comment "Upgrade." - } elseif {$higher_version_p == 0} { - set comment "Package version already installed." - } else { - set comment "Installing older version of package." - } - - append widget " " + " + foreach comment [pkg_info_comment $pkg_info] { + append widget "$comment
" + } + append widget " + + + " + } else { + # No dependency information. + # See if the install is already installed with a higher version number. + if {[apm_package_registered_p $package_key]} { + set higher_version_p [apm_higher_version_installed_p $package_key $version_name] + } else { + set higher_version_p 2 + } + if {$higher_version_p == 2 } { + set comment "New install." + } elseif {$higher_version_p == 1 } { + set comment "Upgrade." + } elseif {$higher_version_p == 0} { + set comment "Package version already installed." + } else { + set comment "Installing older version of package." + } + + append widget " " - if { ([lsearch -exact $to_install $package_key] != -1) } { + if { ([lsearch -exact $to_install $package_key] != -1) } { set install_checked "checked" } else { set install_checked "" } - if { ([lsearch -exact $to_enable $package_key] != -1) } { + if { ([lsearch -exact $to_enable $package_key] != -1) } { set enable_checked "checked" } else { set enable_checked "" } - append widget " - - + if { $install_enable_p } { + append widget " + " + } else { + append widget " + " + } + + append widget " + - - " - } - incr checkbox_count 2 + + " + } + incr checkbox_count 2 } append widget "
InstallEnablePackageDirectoryComment
InstallEnablePackageDirectoryComment
$package(package-name) $package(name)/packages/$package(package.key)/Dependencies satisfied.
$package(package-name) $package(name)/packages/$package(package.key)/
$package(package-name) $package(name)/packages/$package(package.key)/Dependencies satisfied.
$package(package-name) $package(name)/packages/$package(package.key)/ - " - foreach comment [pkg_info_comment $pkg_info] { - append widget "$comment
" - } - append widget " -
$package(package-name) $package(name)$package(package-name) $package(name) /packages/$package(package.key)/$comment
$comment
" return $widget Index: openacs-4/packages/acs-admin/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/Attic/index-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-admin/www/index-oracle.xql 27 Apr 2001 04:09:35 -0000 1.1 +++ openacs-4/packages/acs-admin/www/index-oracle.xql 28 Aug 2003 09:41:37 -0000 1.2 @@ -5,7 +5,7 @@ - select site_node.url(node_id) || 'admin/' as subsite_admin_url, instance_name + select site_node.url(node_id) || 'admin/' as admin_url, instance_name from site_nodes s, apm_packages p where s.object_id = p.package_id and p.package_key = 'acs-subsite' Index: openacs-4/packages/acs-admin/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/Attic/index-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/acs-admin/www/index-postgresql.xql 27 Apr 2001 04:09:35 -0000 1.1 +++ openacs-4/packages/acs-admin/www/index-postgresql.xql 28 Aug 2003 09:41:37 -0000 1.2 @@ -5,7 +5,7 @@ - select site_node__url(node_id) || 'admin/' as subsite_admin_url, instance_name + select site_node__url(node_id) || 'admin/' as admin_url, instance_name from site_nodes s, apm_packages p where s.object_id = p.package_id and p.package_key = 'acs-subsite' Index: openacs-4/packages/acs-admin/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-admin/www/index.adp 28 Aug 2003 09:41:37 -0000 1.2 @@ -0,0 +1,29 @@ + + @page_title@ + +

Core Services

+ + +

+ + +

Subsite Administration

+ + + + +

Package Administration

+ +
Index: openacs-4/packages/acs-admin/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/index.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/acs-admin/www/index.tcl 17 May 2003 09:36:15 -0000 1.6 +++ openacs-4/packages/acs-admin/www/index.tcl 28 Aug 2003 09:41:37 -0000 1.7 @@ -5,52 +5,24 @@ @cvs-id $Id$ } -set title "[ad_conn instance_name] for [ad_system_name]" +set page_title "[ad_conn instance_name] for [ad_system_name]" -set page " -[ad_admin_header $title] -

$title

-[ad_context_bar] -
- -[ad_conn instance_name] is used to administer the site-wide services of the ArsDigita Community System. - - -

-" - -db_foreach subsite_admin_urls { - select site_node.url(node_id) || 'admin/' as subsite_admin_url, +db_multirow subsites subsite_admin_urls { + select site_node.url(node_id) || 'admin/' as admin_url, instance_name from site_nodes s, apm_packages p where s.object_id = p.package_id and p.package_key = 'acs-subsite' -} { - lappend subsite_admin_list "$instance_name Administration" -} if_no_rows { - set subsite_admin_widget "No subsites are available on this system." } -if {! [exists_and_not_null subsite_admin_widget] } { - set subsite_admin_widget " -To administer a particular subsite, please select from the list below. -

    " - foreach url $subsite_admin_list { - append subsite_admin_widget "\n
  • $url
  • " +db_multirow -extend { admin_url } packages installed_packages { + select package_key, + pretty_name as pretty_name + from apm_package_types +} { + if { [apm_package_installed_p $package_key] && [file exists "[acs_package_root_dir $package_key]/www/sitewide-admin/"] } { + set admin_url "package/$package_key/" + } else { + continue } - append subsite_admin_widget " -

\n" -} - -append page " -$subsite_admin_widget -

-[ad_admin_footer] -" - -ns_return 200 text/html $page +} Index: openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl 17 May 2003 09:36:29 -0000 1.7 +++ openacs-4/packages/acs-admin/www/apm/packages-install-2.tcl 28 Aug 2003 09:41:37 -0000 1.8 @@ -14,6 +14,9 @@ # Install and enable are sets of keys; need to turn them back into spec files. set spec_files [ad_get_client_property apm spec_files] +# LARS HACK: I got rid of the separate install/enable checkboxes +set install $enable + # Clear out previous client properties. ad_set_client_property -clob t apm pkg_install_list "" ad_set_client_property -clob t apm pkg_enable_list "" Index: openacs-4/packages/acs-admin/www/apm/packages-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install.tcl,v diff -u -N -r1.15 -r1.16 --- openacs-4/packages/acs-admin/www/apm/packages-install.tcl 17 May 2003 09:36:29 -0000 1.15 +++ openacs-4/packages/acs-admin/www/apm/packages-install.tcl 28 Aug 2003 09:41:37 -0000 1.16 @@ -11,7 +11,7 @@ } ad_return_top_of_page "[apm_header "Package Installation"] -

Please wait while the installer loads ........

+

Please wait while the installer searches your system for packages to install ...

" @@ -74,31 +74,18 @@ ns_write "

Select Packages to Install

- Please select the set of packages you'd like to install - and enable. +

Please select the set of packages you'd like to install.

" -
    -
  • To install a package is to load its data model. -
  • To enable a package is to make it available to users. -
- - If you think you might want to use a package later (but not right away), - install it but don't enable it.

" - - if { [llength $not_compatible_list] > 0 } { - ns_write "

If there's a package that you can't find in the list below, it may be because it's incompatible with your system.

" - } - ns_write " + + +
+ + @actions.label@ + +
+
+ + + + + + + + + +

+ +

+ + + + + +
+ + + + + + + + + + Index: openacs-4/packages/acs-templating/resources/lists/table.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/resources/lists/table.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/resources/lists/table.adp 28 Aug 2003 09:41:45 -0000 1.2 @@ -0,0 +1,259 @@ + + + + + + + +
+ @list_properties.bulk_action_export_chunk@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + << + + + << + + + +  <  + + +  <  + + + + +   \@paginator_pages.page@ + + +   \@paginator_pages.page@ + + + + +  >  + + +  >  + + + + >> + + + >> + + +
+ + @actions.label@ + +
+ + + @elements.label@ + v^ + + + @elements.label;noquote@ + + + + @elements.label;noquote@ + +
+ @list_properties.no_data@ +
+   +
+ @list_properties.groupby_label@: +
+ +
+ + @elements.aggregate_group_label@ + + + \@@list_properties.multirow@.@elements.aggregate_group_col@@ + +
+   +
+ + @elements.aggregate_label@ + + + \@@list_properties.multirow@.@elements.aggregate_col@@ + +
+ + @bulk_actions.label@ + +
+ + Index: openacs-4/packages/acs-templating/tcl/0-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/Attic/0-procs.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/acs-templating/tcl/0-procs.tcl 17 May 2003 10:05:27 -0000 1.11 +++ openacs-4/packages/acs-templating/tcl/0-procs.tcl 28 Aug 2003 09:41:45 -0000 1.12 @@ -53,7 +53,7 @@ # default settings variable defaults - set defaults [list method post section {} mode edit edit_buttons { { "OK" ok } } display_buttons { { "Edit" edit } }] + set defaults [list method post section {} mode edit edit_buttons { { "OK" ok } } display_buttons { { "Edit" edit } } show_required_p t] } namespace eval wizard { Index: openacs-4/packages/acs-templating/tcl/date-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/date-procs.tcl,v diff -u -N -r1.18 -r1.19 --- openacs-4/packages/acs-templating/tcl/date-procs.tcl 17 May 2003 10:05:27 -0000 1.18 +++ openacs-4/packages/acs-templating/tcl/date-procs.tcl 28 Aug 2003 09:41:45 -0000 1.19 @@ -716,10 +716,11 @@ # Create an html fragment to display a numeric range widget # interval_def is in form { start stop interval } -ad_proc -public template::widget::numericRange { name interval_def size {value ""} } { +ad_proc -public template::widget::numericRange { name interval_def size {value ""} {tag_attributes {}} } { Create an html fragment to display a numeric range widget interval_def is in form { start stop interval } } { + array set attributes $tag_attributes set options [list [list "--" {}]] @@ -729,11 +730,11 @@ lappend options [list [template::util::leadingPad $i $size] $i] } - return [template::widget::menu $name $options [list $value] {}] + return [template::widget::menu $name $options [list $value] attributes] } ad_proc -public template::widget::dateFragment { - element_reference fragment size type value {mode edit} } { + element_reference fragment size type value {mode edit} {tag_attributes {}} } { Create an input widget for the given date fragment If type is "t", uses a text widget for the fragment, with the given size. @@ -758,24 +759,35 @@ # Display text entry for some elements, or if the type is text if { [string equal $type t] || [regexp "year|short_year" $fragment] } { - return "\n" + set output "\n" + return $output } else { - # Use a default range for others + # Use a default range for others set interval [template::util::date::defaultInterval $fragment] } - } + } return [template::widget::numericRange "$element(name).$fragment" \ - $interval $size $value] + $interval $size $value $tag_attributes] } } ad_proc -public template::widget::ampmFragment { - element_reference fragment size type value {mode edit} } { + element_reference fragment size type value {mode edit} {tag_attributes {}} } { Create a widget that shows the am/pm selection } { upvar $element_reference element + array set attributes $tag_attributes set value [template::util::date::get_property $fragment $value] @@ -786,18 +798,19 @@ return $output } else { return [template::widget::menu \ - "$element(name).$fragment" { {A.M. am} {P.M. pm}} $value {}] + "$element(name).$fragment" { {A.M. am} {P.M. pm}} $value attributes] } } ad_proc -public template::widget::monthFragment { - element_reference fragment size type value {mode edit} } { + element_reference fragment size type value {mode edit} {tag_attributes {}} } { Create a month entry widget with short or long month names } { variable ::template::util::date::month_data upvar $element_reference element + array set attributes $tag_attributes set value [template::util::date::get_property $fragment $value] @@ -815,7 +828,7 @@ } return [template::widget::menu \ - "$element(name).$fragment" $options $value {} ] + "$element(name).$fragment" $options $value attributes] } } @@ -916,14 +929,15 @@ # Output the widget set fragment_def $template::util::date::fragment_widgets([string toupper $token]) set fragment [lindex $fragment_def 1] - + append output [template::widget::[lindex $fragment_def 0] \ element \ $fragment \ [lindex $fragment_def 2] \ $type \ $value \ - $element(mode)] + $element(mode) \ + [array get attributes]] # Output the separator if { [string equal $sep " "] } { Index: openacs-4/packages/acs-templating/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/form-procs.tcl,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/acs-templating/tcl/form-procs.tcl 22 Aug 2003 10:11:34 -0000 1.13 +++ openacs-4/packages/acs-templating/tcl/form-procs.tcl 28 Aug 2003 09:41:45 -0000 1.14 @@ -105,6 +105,9 @@ @option elements A block of element specifications. + @option show_required_p Should the form template show which elements are required. + Use 1 or t for true, 0 or f for false. Defaults to true. + @see template::form::get_button @see template::form::get_action @@ -350,9 +353,12 @@ if { [string equal $style {}] } { set style [parameter::get \ - -package_id [apm_package_id_from_key "acs-templating"] \ + -package_id [ad_conn subsite_id] \ -parameter DefaultFormStyle \ - -default "standard"] + -default [parameter::get \ + -package_id [apm_package_id_from_key "acs-templating"] \ + -parameter DefaultFormStyle \ + -default "standard-lars"]] } set file_stub [template::get_resource_path]/forms/$style @@ -440,19 +446,17 @@ # make a reference to the formerror array with any validation messages upvar #$level $id:error $id:error + # Clear the formerror array if it has + # been set by another form on the same page + upvar #$level formerror formerror + if { [info exists formerror] } { unset formerror } + if { [info exists $id:error] } { uplevel #$level "upvar 0 $id:error formerror" # There were errors on the form, force edit mode set properties(mode) edit - - } else { - - # no errors on this form. Clear the formerror array if it has - # been set by another form on the same page - upvar #$level formerror formerror - if { [info exists formerror] } { unset formerror } } # Propagate form mode to all form elements @@ -468,6 +472,17 @@ } } + # Check for errors in hidden elements + foreach element_ref $elements { + + # get a reference by element ID + upvar #$level $element_ref element + + if { [string equal $element(widget) "hidden"] && [exists_and_not_null $id:error($element(id))] } { + error "Validation error in hidden form element: '[set $id:error($element(id))]' on element '$element(id)'." + } + } + # get any additional attributes developer specified to include in form tag if { [info exists properties(html)] } { array set attributes $properties(html) Index: openacs-4/packages/acs-templating/tcl/list-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/list-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-templating/tcl/list-procs.tcl 28 Aug 2003 09:41:45 -0000 1.2 @@ -0,0 +1,2435 @@ +ad_library { + Procs for the list builder. + + @author Lars Pind (lars@collaboraid.biz) + @creation-date 2003-05-16 + @cvs-id $Id: list-procs.tcl,v 1.2 2003/08/28 09:41:45 lars Exp $ +} + +namespace eval template::list {} +namespace eval template::list::element {} +namespace eval template::list::filter {} +namespace eval template::list::format {} +namespace eval template::list::orderby {} + + +##### +# +# template::list namespace +# +##### + +ad_proc -public template::list::create { + {-name:required} + {-multirow:required} + {-key ""} + {-pass_properties ""} + {-actions ""} + {-bulk_actions ""} + {-bulk_action_export_vars ""} + {-selected_format ""} + {-has_checkboxes:boolean} + {-checkbox_name "checkbox"} + {-orderby_name "orderby"} + {-row_pretty_plural "data"} + {-no_data ""} + {-main_class "list"} + {-sub_class ""} + {-class ""} + {-html ""} + {-page_size ""} + {-page_groupsize 10} + {-page_query ""} + {-page_query_name ""} + {-page_flush_p 0} + {-ulevel 1} + {-elements:required} + {-filters ""} + {-groupby ""} + {-orderby ""} + {-formats ""} +} { + Defines a list to be diplayed in a template. The list works in conjunction with a multirow, which contains the data for the list. + The list is output using the <listtemplate> and <listfilters> templating tags, with the help of <listelement> and <listrow>. + +

+ + Here's an example of a fairly simple standard list. + +

+    template::list::create \ 
+        -name order_lines \ 
+        -multirow order_lines \ 
+        -key item_id \ 
+        -actions [list "Add item" [export_vars -base item-add {order_id}] "Add item to this order"] \ 
+        -bulk_actions {
+            "Remove" "item-remove" "Remove checked items"
+        } \ 
+        -bulk_action_export_vars {
+            order_id
+        } \ 
+        -row_pretty_plural "order items" \ 
+        -elements {
+            quantity {
+                label "Quantity"
+            }
+            item_id {
+                label "Item"
+                display_col item_name
+                link_url_col item_url
+                link_html { title "View this item" }
+            }
+            item_price {
+                label "Price"
+                display_eval {[lc_sepfmt $item_price]}
+            }
+            extended_price {
+                label "Extended Price"
+                display_eval {[lc_sepfmt [expr $quantity $item_price]]}
+            }
+        }
+
+    db_multirow -extend { item_url } order_lines select_order_lines {
+        select l.item_id,
+               l.quantity,
+               i.name as item_name,
+               i.price as item_price
+        from   order_lines l,
+               items i
+        where  l.order_id = :order_id
+        and    i.item_id = l.item_id
+    } {
+        set item_url [export_vars -base "item" { item_id }]
+    }
+    
+ + And the ADP template would include this: + +
+    <listtemplate name="order_lines"></listtemplate>
+    
+ + + @param name The name of the list you want to build. + + @param multirow The name of the multirow which you want to loop over. + + @param key The name of the column holding the primary key/unique identifier for each row. + Must be a single column, which must be present in the multirow. + This switch is required to have bulk actions. + + @param pass_properties + A list of variables in the caller's namespace, which should be avilable to the display_template + of elements. + + @param actions A list of action buttons to display at the top of + the list in the form (label1 url1 title1 label2 url2 title2 ...). + The action button will be a simple link to the url. + + @param bulk_actions A list of bulk action buttons, operating on the checked rows, + to display at the bottom of + the list. The format is (label1 url1 title1 label2 url2 title2 ...). + A form will be submitted to the url, containing a list of the key values of the checked rows. + For example, if 'key' is 'message_id', and rows with message_id 2 4 and 9 are chcked, the + page will get variables message_id=2&message_id=4&message_id=9. The receiving page + should declare message_id:integer,multiple in its ad_page_contract. Note that the 'message_id' + local variable will the be a Tcl list. + + @param bulk_action_export_vars + A list of additional variables to pass to the receving page, along with the other variables for + the selected keys. This is typically useful if the rows in this list are all hanging off of + one row in a parent table. For example, if this list contains the order lines of one particular + order, and the primary key of the order lines table is 'order_id, item_id', the key would be + 'item_id', and bulk_action_export_vars would be 'order_id', so together they constitute the + primary key. + + @param selected_format + The currently selected display format. See the 'formats' option. + + @param has_checkboxes Set this flag if your table already includes the checkboxes for the bulk actions. + If not, and your list has bulk actions, we will add a checkbox column for you as the first column. + + @param checkbox_name You can explicitly name the checkbox column here, so you can refer to it and place it where you + want it when you specify display formats. Defaults to 'checkbox'. See the 'formats' option. + + @param row_pretty_plural + The pretty name of the rows in plural. For example 'items' or 'forum postings'. This is used to + auto-generate the 'no_data' message to say "No (row_pretty_plural)." Defaults to 'data'. See 'no_data' below. + + @param no_data The message to display when the multirow has no rows. Defaults to 'No data.'. + + @param main_class The main CSS class to be used in the output. The CSS class is constructed by combining the + main_class and the sub_class with a dash in between. E.g., main_class could be 'list', and + sub_class could be 'narrow', in which case the resuling CSS class used would be 'list-narrow'. + + @param sub_class The sub-part of the CSS class to use. See 'main_class' option. + + @param class Alternatively, you can specify the CSS class directly. If specified, this overrides main_class/sub_class. + + @param html HTML attributes to be output for the table tag, e.g. { align right style "background-color: yellow;" }. + Value should be a Tcl list with { name value name value } + + @param page_size The number of rows to display on each page. If specified, the list will be paginated. + + @param page_groupsize The page group size for the paginator. See template::paginator::create for more details. + + + @param page_query The query to get the row IDs and contexts for the entire result set. See template::paginator::create for details. + + @param page_query_name + Alternatively, you can specify a query name. See template::paginator::create for details. + + @param ulevel The number of levels to uplevel when doing subst on values for elements, filters, groupbys, orderbys + and formats below. Defaults to one level up, which means the caller of template::list::create's scope. + + @param elements The list elements (columns). + The value should be an array-list of (element-name, spec) pairs, like in the example above. Each spec, in turn, is an array-list of + property-name/value pairs, where the value is 'subst'ed in the caller's environment, except for the *_eval properties, which are + 'subst'ed in the multirow context. + See template::list::element::create for details. + + @param filters Filters for the list. Typically used to slice the data, for example to see only rows by a particular user. + Array-list of (filter-name, spec) pairs, like elements. Each spec, in turn, is an array-list of property-name/value pairs, + where the value is 'subst'ed in the caller's environment, except for the *_eval properties, which are 'subst'ed in the multirow context. + In order for filters to work, you have to specify them in your page's ad_page_contract, typically as filter_name:optional. The list builder will find them from there, + by grabbing them from your page's local variables. + See template::list::filter::create for details. + + @param groupby Things you can group by, e.g. day, week, user, etc. Automatically creates a filter called 'groupby'. + Single array-list of property-name/value pairs, where the value is 'subst'ed in the caller's environment. + Groupby is really just a filter with a fixed name, so see above for more details. + See template::list::filter::create for details. + + @param orderby Things you can order by. You can also specify ordering directly in the elements. Automatically creates a filter called 'orderby'. + Array-list of (orderby-name, spec) pairs, like elements. Each spec, in turn, is an array-list of property-name/value pairs, + where the value is 'subst'ed in the caller's environment, except for the *_eval properties, which are 'subst'ed in the multirow context. + If the name of your orderby is the same as the name of an element, that element's header will be made a link to sort by that column. + See template::list::orderby::create for details. + + @param orderby_name The page query variable name for the selected orderby is normally named 'orderby', but if you want to, you can + override it here. + + @param formats If no formats are specified, a default format is created. Automatically creates a filter called 'format'. + Array-list of (format-name, spec) pairs, like elements. Each spec, in turn, is an array-list of property-name/value pairs, + where the value is 'subst'ed in the caller's environment. + See template::list::format::create for details. + + + @see template::list::element::create + @see template::list::filter::create + @see template::list::orderby::create + @see template::list::format::create +} { + set level [template::adp_level] + + # Get an upvar'd reference to list_properties + get_reference -create -name $name + + # Setup some list defaults + array set list_properties { + key {} + multirow {} + style {} + page_size {} + page_groupsize {} + page_query {} + page_query_name {} + page_flush_p {} + main_class {list} + sub_class {} + class {} + html {} + actions {} + bulk_actions {} + bulk_action_export_vars {} + orderby_name {orderby} + } + + # These are defauls for internally maintained properties + array set list_properties { + elements {} + element_refs {} + display_elements {} + filters {} + filters_export {} + filter_refs {} + filter_where_clauses {} + dynamic_cols_p 0 + aggregates_p 0 + groupby {} + groupby_label {} + format_refs {} + row_template {} + orderby_refs {} + orderby_selected_name {} + orderby_selected_direction {} + ulevel {} + output {} + bulk_action_export_chunk {} + } + + # Set default for no_data + set no_data [ad_decode $no_data "" "No $row_pretty_plural." $no_data] + # Set ulevel to the level of the page, so we can access it later + set list_properties(ulevel) "\#[expr [info level] - $ulevel]" + + # Set properties from the parameters passed + foreach elm { + name + key + multirow + pass_properties + actions + bulk_actions + bulk_action_export_vars + row_pretty_plural + no_data + main_class + sub_class + class + html + page_size + page_groupsize + page_query + page_query_name + page_flush_p + orderby_name + } { + set list_properties($elm) [set $elm] + } + + # Default 'class' to 'main_class' + if { [empty_string_p $list_properties(class)] } { + set list_properties(class) $list_properties(main_class) + } + + # Set up automatic 'checkbox' element as the first element + if { !$has_checkboxes_p && [llength $bulk_actions] > 0 && ![empty_string_p $key] } { + # Create the checkbox element + # We only ulevel 1 here, because we want the subst to be done in this namespace + template::list::element::create \ + -list_name $name \ + -element_name $checkbox_name \ + -spec { + label {} + display_template {} + sub_class {narrow} + html { align center } + } + } + + # Define the elements + foreach { elm_name elm_spec } $elements { + # Create the element + # Need to uplevel 2 the subst command to get to our caller's namespace + template::list::element::create \ + -list_name $name \ + -element_name $elm_name \ + -spec $elm_spec \ + -ulevel 2 + } + + set reserved_filter_names { groupby orderby format page } + + # Handle filters + foreach { dim_name dim_spec } $filters { + if { [lsearch $reserved_filter_names $dim_name] != -1 } { + error "The name '$dim_name' is a reserved filter name. Reserved names are [join $reserved_filter_named ", "]." + } + template::list::filter::create \ + -list_name $name \ + -filter_name $dim_name \ + -spec $dim_spec \ + -ulevel 2 + } + + # Groupby (this is also a filter, but a special one) + if { [llength $groupby] > 0 } { + template::list::filter::create \ + -list_name $name \ + -filter_name "groupby" \ + -spec $groupby \ + -ulevel 2 + } + + # Orderby + if { [llength $orderby] > 0 } { + + set filter_default {} + + foreach { orderby_name orderby_spec } $orderby { + if { [string equal $orderby_name "default_value"] } { + set filter_default $orderby_spec + } else { + template::list::orderby::create \ + -list_name $name \ + -orderby_name $orderby_name \ + -spec $orderby_spec \ + -ulevel 2 + } + } + + template::list::filter::set_property \ + -list_name $name \ + -filter_name $list_properties(orderby_name) \ + -property default_value \ + -value $filter_default \ + -ulevel 2 + } + + # Formats + if { [llength $formats] > 0 } { + set filter_values {} + foreach { format_name format_spec } $formats { + lappend filter_values [template::list::format::create \ + -list_name $name \ + -format_name $format_name \ + -selected_format $selected_format \ + -spec $format_spec \ + -ulevel 2] + } + set filter_spec [list label "Formats" values $filter_values has_default_p 1] + + template::list::filter::create \ + -list_name $name \ + -filter_name "format" \ + -spec $filter_spec \ + -ulevel 2 + } + + # Pagination + if { ![empty_string_p $list_properties(page_size)] && $list_properties(page_size) != 0 } { + # Check that we have either page_query or page_query_name + if { [empty_string_p $list_properties(page_query)] && [empty_string_p $list_properties(page_query_name)] } { + error "When specifying a non-zero page_size, you must also provide either page_query or page_query_name" + } + + if { [empty_string_p $list_properties(page_query_name)] } { + set list_properties(page_query_name) "--default-query-name-for-list-builder-paginators--" + } + + # We create the selected page as a filter, so we get the filter,page thing out + template::list::filter::create \ + -list_name $name \ + -filter_name "page" \ + -spec [list label "Page" default_value 1 hide_p t] + } + + # Done, prepare the list. This has to be done while we still have access to the caller's scope + prepare \ + -name $name \ + -ulevel 2 +} + +ad_proc -public template::list::prepare { + {-name:required} + {-ulevel 1} +} { + Prepare list for rendering +} { + # Get an upvar'd reference to list_properties + get_reference -name $name + + # Default the display_elements property to be all elements + if { [llength $list_properties(display_elements)] == 0 } { + set list_properties(display_elements) $list_properties(elements) + } + + # Set the bulk_action_export_chunk + if { ![empty_string_p $list_properties(bulk_action_export_vars)] } { + set list_properties(bulk_action_export_chunk) [uplevel $list_properties(ulevel) \ + [list export_vars -form $list_properties(bulk_action_export_vars)]] + } + + # This sets urls, selected_p, etc., for filters, plus sets the (filter,name) var in list_properties + prepare_filters \ + -name $name + + # Split the current ordering info into name and direction + # name is the string before the comma, order (asc/desc) is what's after + if { [info exists list_properties(filter,$list_properties(orderby_name))] } { + foreach { orderby_name orderby_direction } [lrange [split $list_properties(filter,$list_properties(orderby_name)) ","] 0 1] {} + set list_properties(orderby_selected_name) $orderby_name + set list_properties(orderby_selected_direction) $orderby_direction + } + + # This sets orderby, etc., for filters + prepare_elements \ + -name $name \ + -ulevel [expr $ulevel + 1] + + # Make groupby information available to templates + if { [exists_and_not_null list_properties(filter,groupby)] } { + set list_properties(groupby) $list_properties(filter,groupby) + } + if { [exists_and_not_null list_properties(filter_label,groupby)] } { + set list_properties(groupby_label) $list_properties(filter_label,groupby) + } + + # Create the paginator + if { ![empty_string_p $list_properties(page_size)] && $list_properties(page_size) != 0 } { + + # We need to uplevel subst it so we get the filters evaluated + set list_properties(page_query_substed) [uplevel $list_properties(ulevel) [list subst -nobackslashes $list_properties(page_query)]] + + # Generate a paginator name which includes all the fitler values, + # so the paginator cahing works properly + set paginator_name $list_properties(name) + foreach filter $list_properties(filters) { + if { [info exists list_properties(filter,$filter)] } { + append paginator_name ",$filter=$list_properties(filter,$filter)" + } + } + set list_properties(paginator_name) $paginator_name + + set flush_p f + if { [template::util::is_true $list_properties(page_flush_p)] } { + set flush_p t + } + + # We need this uplevel so that the bind variables in the query will get bound at the caller's level + uplevel $ulevel [list template::paginator create \ + $list_properties(page_query_name) \ + $list_properties(paginator_name) \ + $list_properties(page_query_substed) \ + -pagesize $list_properties(page_size) \ + -groupsize $list_properties(page_groupsize) \ + -flush_p $flush_p \ + -contextual] + + if { $list_properties(filter,page) > [template::paginator get_page_count $list_properties(paginator_name)] } { + set list_properties(filter,page) [template::paginator get_page_count $list_properties(paginator_name)] + } + + } +} + +ad_proc -public template::list::get_refname { + {-name:required} +} { + return "$name:properties" +} + +ad_proc -public template::list::get_reference { + {-name:required} + {-local_name "list_properties"} + {-create:boolean} +} { + set refname [get_refname -name $name] + + if { !$create_p && ![uplevel \#[template::adp_level] info exists $refname] } { + error "List '$name' not found" + } + + uplevel upvar #[template::adp_level] $refname $local_name +} + +ad_proc -private template::list::get_url { + {-name:required} + {-override ""} + {-exclude ""} +} { + @param and Set this flag if you want the result to start with an 'and' if the list of where clauses returned is non-empty. +} { + # Get an upvar'd reference to list_properties + get_reference -name $name + + return [uplevel $list_properties(ulevel) \ + [list export_vars \ + -no_empty \ + -base [ad_conn url] \ + -exclude $exclude \ + -override $override \ + $list_properties(filters_export)]] +} + + + ad_proc -public template::list::filter_where_clauses { + -name:required + -and:boolean +} { + @param and Set this flag if you want the result to start with an 'and' if the list of where clauses returned is non-empty. +} { + # Get an upvar'd reference to list_properties + get_reference -name $name + + if { [llength $list_properties(filter_where_clauses)] == 0 } { + return {} + } + + set result {} + if { $and_p } { + append result "and " + } + append result [join $list_properties(filter_where_clauses) "\n and "] + + return $result +} + +ad_proc -public template::list::page_where_clause { + -name:required + -and:boolean + {-key} +} { + @param and Set this flag if you want the result to start with an 'and' if the list of where clauses returned is non-empty. + + @param key Specify the name of the primary key to be used in the query's where clause, + if different from the list builder's key. +} { + # Get an upvar'd reference to list_properties + get_reference -name $name + + if { [empty_string_p $list_properties(page_size)] || $list_properties(page_size) == 0 } { + return {} + } + + set result {} + + if { $and_p } { + append result "and " + } + + if { ![exists_and_not_null key] } { + set key $list_properties(key) + } + + append result "$key in ([page_get_ids -name $name])" + + return $result +} + +ad_proc -public template::list::write_output { + -name:required +} { + Writes the output to the connection if output isn't set to template. + Will automatically issue an ad_script_abort, if the output has been written + directly to the connection instead of through the templating system. +} { + # Get an upvar'd reference to list_properties + get_reference -name $name + + switch $list_properties(output) { + csv { + write_csv -name $name + ad_script_abort + } + } +} + +ad_proc -public template::list::csv_quote { + string +} { + regsub -all {\"} $string {""} result + return $result +} + +ad_proc -public template::list::write_csv { + -name:required +} { + Writes a CSV to the connection +} { + # Creates the '_eval' columns and aggregates + template::list::prepare_for_rendering -name $name + + get_reference -name $name + + set __list_name $name + set __output {} + + # Output header row + set __cols [list] + foreach __element_name $list_properties(display_elements) { + lappend __cols [csv_quote $__element_name] + } + append __output "\"[join $__cols "\",\""]\"\n" + + + # Output rows + template::multirow foreach $list_properties(multirow) { + + set __cols [list] + + foreach __element_name $list_properties(display_elements) { + template::list::element::get_reference \ + -list_name $__list_name \ + -element_name $__element_name \ + -local_name __element_properties + + if { [info exists $__element_properties(csv_col)] } { + lappend __cols [csv_quote [set $__element_properties(csv_col)]] + } + } + append __output "\"[join $__cols "\",\""]\"\n" + } + + ns_return 200 text/plain $__output +} + + +ad_proc -public template::list::page_get_ids { + -name:required + -tcl_list:boolean +} { + @param name Name of the list builder list for which you want the IDs of the current page. + @param tcl_list Set this option if you want the IDs as a Tcl list. Otherwise, they'll be returned as a + quoted SQL list, ready to be included in an "where foo_id in (...)" expression. +} { + # Get an upvar'd reference to list_properties + get_reference -name $name + + if { [empty_string_p $list_properties(page_size)] || $list_properties(page_size) == 0 } { + return {} + } + + if { $tcl_list_p } { + return [template::paginator get_row_ids $list_properties(paginator_name) $list_properties(filter,page)] + } else { + return [template::paginator get_query $list_properties(paginator_name) $list_properties(key) $list_properties(filter,page)] + } +} + +ad_proc -public template::list::page_get_rowcount { + -name:required +} { + Gets the number of rows across all pages in a paginated result set. + + @param name Name of the list builder list for which you want the number of rows in the result set. +} { + # Get an upvar'd reference to list_properties + get_reference -name $name + + if { [empty_string_p $list_properties(page_size)] || $list_properties(page_size) == 0 } { + return {} + } + + return [template::paginator get_row_count $list_properties(paginator_name)] +} + + + +ad_proc -public template::list::orderby_clause { + -name:required + -orderby:boolean +} { + @param boolean Set this flag if you want the result to start with an 'order by' if the orderby clause returned is non-empty. + + @param orderby If this is specified, this proc will also spit out the "order by" part, so it can be used directly + in the query without saying 'order by' yourself. + +} { + # Get an upvar'd reference to list_properties + get_reference -name $name + + if { [empty_string_p $list_properties(orderby_selected_name)] } { + return {} + } + + set result {} + if { $orderby_p } { + append result "order by " + } + template::list::orderby::get_reference -list_name $name -orderby_name $list_properties(orderby_selected_name) + + append result $orderby_properties(orderby_$list_properties(orderby_selected_direction)) + + return $result +} + +ad_proc -private template::list::template { + {-name:required} + {-style ""} +} { + Process a list template with the special hacks into becoming a + 'real' ADP template, as if it was included directly in the page. + Will provide that template with a multirow named 'elements'. +} { + set level [template::adp_level] + + # Get an upvar'd reference to list_properties + get_reference -name $name + + # + # Create 'actions' and 'bulk_actions' multirows + # + + # Manually construct a multirow by setting the relevant variables + foreach type { actions bulk_actions } { + set ${type}:rowcount 0 + + foreach { label url title } $list_properties(${type}) { + incr ${type}:rowcount + set "${type}:[set "${type}:rowcount"](label)" $label + set "${type}:[set "${type}:rowcount"](url)" $url + set "${type}:[set "${type}:rowcount"](title)" $title + set "${type}:[set "${type}:rowcount"](rownum)" [set "${type}:rowcount"] + } + } + + # + # Create 'elements' multirow + # + + # Manually construct a multirow by upvar'ing each of the element refs + set elements:rowcount 0 + + foreach element_name $list_properties(display_elements) { + set element_ref [template::list::element::get_refname \ + -list_name $name \ + -element_name $element_name] + upvar #$level $element_ref element_properties + + if { ![template::util::is_true $element_properties(hide_p)] } { + incr elements:rowcount + + # get a reference by index for the multirow data source + upvar #$level $element_ref elements:${elements:rowcount} + + # Also set the rownum pseudocolumn + set "elements:${elements:rowcount}(rownum)" ${elements:rowcount} + } + } + + # Table tag HTML attributes + set list_properties(table_attributes) [template::list::util_html_to_attributes_string $list_properties(html)] + + # + # Find the list template + # + + if { [string equal $style {}] } { + set style $list_properties(style) + } + + if { [string equal $style {}] } { + set style [parameter::get \ + -package_id [ad_conn subsite_id] \ + -parameter DefaultListStyle \ + -default [parameter::get \ + -package_id [apm_package_id_from_key "acs-templating"] \ + -parameter DefaultListStyle \ + -default "table"]] + } + set file_stub "[template::get_resource_path]/lists/$style" + + # ensure that the style template has been compiled and is up-to-date + template::adp_init adp $file_stub + + # get result of template output procedure into __adp_output + # the only data source on which this template depends is the "elements" + # multirow data source. The output of this procedure will be + # placed in __adp_output in this stack frame. + + #ns_log Notice "LARS: Code source: [info body template::code::adp::$file_stub]" + + template::code::adp::$file_stub + + #ns_log Notice "LARS: template::list::template returns: $__adp_output" + + return $__adp_output +} + +ad_proc -private template::list::prepare_for_rendering { + {-name:required} +} { + set __level [template::adp_level] + + # Provide a reference to the list properties for use by the list template + # This one is named __list_properties to avoid getting scrambled by below multirow + get_reference -name $name -local_name __list_properties + + # Upvar other variables passed in through the pass_properties property + foreach var $__list_properties(pass_properties) { + upvar #$__level $var $var + } + + # + # Dynamic columns: display_eval, link_url_eval, aggregate + # + + if { $__list_properties(dynamic_cols_p) || $__list_properties(aggregates_p) } { + foreach element_ref $__list_properties(element_refs) { + # We don't need to prefix it with __ to become __element_properties here + # because we're not doing the multirow foreach loop yet. + upvar #$__level $element_ref element_properties + + # display_eval, link_url_eval + foreach eval_property { display link_url } { + if { [exists_and_not_null element_properties(${eval_property}_eval)] } { + + # Set the display col to the name of the new, dynamic column + set element_properties(${eval_property}_col) "$element_properties(name)___$eval_property" + + # And add that column to the multirow + template::multirow extend $__list_properties(multirow) $element_properties(${eval_property}_col) + } + } + + # aggregate + if { [exists_and_not_null element_properties(aggregate)] } { + # Set the aggregate_col to the name of the new, dynamic column + set element_properties(aggregate_col) "$element_properties(name)___$element_properties(aggregate)" + set element_properties(aggregate_group_col) "$element_properties(name)___$element_properties(aggregate)_group" + + # Add that column to the multirow + template::multirow extend $__list_properties(multirow) $element_properties(aggregate_col) + template::multirow extend $__list_properties(multirow) $element_properties(aggregate_group_col) + + # Initialize our counters to 0 + set __agg_counter($element_properties(name)) 0 + set __agg_sum($element_properties(name)) 0 + + # Just in case, we also initialize our group counters to 0 + set __agg_group_counter($element_properties(name)) 0 + set __agg_group_sum($element_properties(name)) 0 + } + } + + # This keeps track of the value of the group-by column for sub-totals + set __last_group_val {} + + template::multirow foreach $__list_properties(multirow) { + + foreach element_ref $__list_properties(element_refs) { + # We do need to prefix it with __ to become __element_properties here + # because we are inside the multirow foreach loop yet. + # LARS: That means we should probably also __-prefix element_ref, eval_property, and others. + upvar #$__level $element_ref __element_properties + + # display_eval, link_url_eval + foreach eval_property { display link_url } { + if { [exists_and_not_null __element_properties(${eval_property}_eval)] } { + set $__element_properties(${eval_property}_col) [subst $__element_properties(${eval_property}_eval)] + } + } + + # aggregate + if { [exists_and_not_null __element_properties(aggregate)] } { + # Update totals + incr __agg_counter($__element_properties(name)) + set __agg_sum($__element_properties(name)) \ + [expr $__agg_sum($__element_properties(name)) + [set $__element_properties(name)]] + + # Check if the value of the groupby column has changed + if { [exists_and_not_null $__list_properties(groupby)] } { + if { ![string equal $__last_group_val [set $__list_properties(groupby)]] } { + # Initialize our group counters to 0 + set __agg_group_counter($__element_properties(name)) 0 + set __agg_group_sum($__element_properties(name)) 0 + } + # Update subtotals + incr __agg_group_counter($__element_properties(name)) + set __agg_group_sum($__element_properties(name)) \ + [expr $__agg_group_sum($__element_properties(name)) + [set $__element_properties(name)]] + } + + switch $__element_properties(aggregate) { + sum { + set $__element_properties(aggregate_col) $__agg_sum($__element_properties(name)) + if { [exists_and_not_null $__list_properties(groupby)] } { + set $__element_properties(aggregate_group_col) $__agg_group_sum($__element_properties(name)) + } + } + average { + set $__element_properties(aggregate_col) \ + [expr $__agg_sum($__element_properties(name)) / $__agg_counter($__element_properties(name))] + if { [exists_and_not_null $__list_properties(groupby)] } { + set $__element_properties(aggregate_group_col) \ + [expr $__agg_sum($__element_properties(name)) / $__agg_group_counter($__element_properties(name))] + } + } + count { + set $__element_properties(aggregate_col) \ + [expr $__agg_counter($__element_properties(name))] + if { [exists_and_not_null $__list_properties(groupby)] } { + set $__element_properties(aggregate_group_col) \ + [expr $__agg_group_counter($__element_properties(name))] + } + } + default { + error "Unknown aggregate function '$__element_properties(aggregate)'" + } + } + } + } + + # Remember this value of the groupby column + if { [exists_and_not_null $__list_properties(groupby)] } { + set __last_group_val [set $__list_properties(groupby)] + } + } + } +} + + +ad_proc -private template::list::render { + {-name:required} + {-style ""} +} { + set level [template::adp_level] + + # Creates the '_eval' columns and aggregates + template::list::prepare_for_rendering -name $name + + # Get an upvar'd reference to list_properties + get_reference -name $name + + # This gets and actually compiles the dynamic template into the template to use for the output + # Thus, we need to do the dynamic columns above before this step + set __adp_output [template -name $name -style $style] + + # compile the template (this is the second compilation, if we're using a dynamic template -- I think) + set __list_code [template::adp_compile -string $__adp_output] + + # Paginator + if { ![empty_string_p $list_properties(page_size)] && $list_properties(page_size) != 0 } { + + set current_page $list_properties(filter,page) + + template::paginator get_display_info $list_properties(paginator_name) paginator $current_page + + # Set the URLs which the next/prev page/group links should point to + foreach elm { next_page previous_page next_group previous_group } { + if { [exists_and_not_null paginator($elm)] } { + set paginator(${elm}_url) [get_url \ + -name $list_properties(name) \ + -override [list [list page $paginator($elm)]]] + } + } + + # LARS HACK: + # Use this if you want to display the pages around the currently selected page, + # with num_pages pages before and num_pages after the currently selected page. + # This is an alternative to 'groups' of pages, and should eventually be built + # into paginator, should we decide that this is a nicer way to do things + # (I stole the idea from Google). + # However, for now, it's just commented out with an if 0 ... block. + if 0 { + set num_pages 11 + set pages [list] + for { set i [expr $current_page - $num_pages] } { $i < [expr $current_page + $num_pages] } { incr i } { + if { $i > 0 && $i <= $paginator(page_count) } { + lappend pages $i + } + } + } + + set pages [template::paginator get_pages \ + $list_properties(paginator_name) \ + $paginator(current_group)] + + template::paginator get_context \ + $list_properties(paginator_name) \ + paginator_pages \ + $pages + + # Add URL to the pages + template::multirow -local extend paginator_pages url + + template::multirow -local foreach paginator_pages { + set url [get_url -name $list_properties(name) -override [list [list page $page]]] + } + + # LARS HACK: + # This gets info for all the groups, in case you want to display all the groups available + # We don't currently do this, so I've commented it out with an if 0 ... block + if 0 { + template::paginator get_context \ + $list_properties(paginator_name) \ + paginator_groups \ + [template::paginator get_groups activities $paginator(current_group) $list_properties(page_groupsize)] + } + } + + # Get the multirow upvar'd to this namespace + template::multirow upvar $list_properties(multirow) + + # Upvar other variables passed in through the pass_properties property + foreach var $list_properties(pass_properties) { + upvar #$level $var $var + } + + # evaluate the code and return the rendered HTML for the list + set __output [template::adp_eval __list_code] + + #ns_log Notice "LARS: template::list::render returning => $__output" + + return $__output +} + +ad_proc -private template::list::render_row { + {-name:required} +} { + set level [template::adp_level] + + # Get an upvar'd reference to list_properties + get_reference -name $name + + set __adp_output $list_properties(row_template) + + #ns_log Notice "LARS: render_row. __adp_output = $__adp_output" + + # compile the template (this is the second compilation, if we're using a dynamic template -- I think) + set __list_code [template::adp_compile -string $__adp_output] + + # Get the multirow upvar'd to this namespace + template::multirow upvar $list_properties(multirow) + + # Upvar other variables passed in through the pass_properties property + foreach var $list_properties(pass_properties) { + upvar #$level $var $var + } + + # Get the list definition upvar'd to this namespace + upvar #$level [get_refname -name $name] [get_refname -name $name] + foreach element_ref $list_properties(element_refs) { + upvar #$level $element_ref $element_ref + } + + # evaluate the code and return the rendered HTML for the list + set output [template::adp_eval __list_code] + + return $output +} + + + +ad_proc -private template::list::prepare_elements { + {-name:required} + {-ulevel 1} +} { + Builds urls, selected_p, etc., for filters +} { + # Get an upvar'd reference to list_properties + get_reference -name $name + + foreach element_name $list_properties(elements) { + template::list::element::get_reference -list_name $name -element_name $element_name + + if { ![empty_string_p $element_properties(default_direction)] } { + + if { [string equal $list_properties(orderby_selected_name) $element_name] } { + # We're currently ordering on this column + set direction [ad_decode $list_properties(orderby_selected_direction) "asc" "desc" "asc"] + set element_properties(orderby_url) [get_url \ + -name $name \ + -override [list [list $list_properties(orderby_name) "${element_name},$direction"]]] + set element_properties(orderby_html_title) "Reverse the sort order of this column" + set element_properties(ordering_p) "t" + set element_properties(orderby_direction) $list_properties(orderby_selected_direction) + + } else { + # We're not currently ordering on this column + set element_properties(orderby_url) [get_url \ + -name $name \ + -override [list [list $list_properties(orderby_name) "${element_name},$element_properties(default_direction)"]]] + set element_properties(orderby_html_title) "Sort the list by this column" + } + } + } + } + + +ad_proc -private template::list::prepare_filters { + {-name:required} +} { + Builds urls, selected_p, etc., for filters +} { + set level [template::adp_level] + + # Get an upvar'd reference to list_properties + get_reference -name $name + + # Construct URLs for the filters now, while we still have access to the caller's namespace + foreach filter_ref $list_properties(filter_refs) { + upvar #$level $filter_ref filter_properties + + upvar $list_properties(ulevel) $filter_properties(name) current_filter_value + + # Set to default value if undefined + if { ![exists_and_not_null current_filter_value] && ![empty_string_p $filter_properties(default_value)] } { + set current_filter_value $filter_properties(default_value) + } + + # Does the filter have a current value? + if { [exists_and_not_null current_filter_value] } { + + # Get the where clause + if { ![empty_string_p $filter_properties(where_clause)] } { + lappend list_properties(filter_where_clauses) $filter_properties(where_clause) + } elseif { ![empty_string_p $filter_properties(where_clause_eval)] } { + lappend list_properties(filter_where_clauses) [uplevel $list_properties(ulevel) $filter_properties(where_clause_eval)] + } + + # Get the clear_url + if { ![template::util::is_true $filter_properties(has_default_p)] } { + set filter_properties(clear_url) [get_url \ + -name $name \ + -exclude [list $filter_properties(name)]] + } + + # Remember the filter value + set list_properties(filter,$filter_properties(name)) $current_filter_value + } + + # If none were found, we may need to provide an 'other' entry below + set found_selected_p 0 + + # Now generate selected_p, urls, add_urls + foreach elm $filter_properties(values) { + + # Set label and value from the list element + # We do an lrange here, otherwise values would be set wrong + # in case someone accidentally supplies a list with too many elements, + # because then the foreach loop would run more than once + foreach { label value count } [lrange $elm 0 2] {} + + switch $filter_properties(type) { + singleval { + set selected_p [exists_and_equal current_filter_value $value] + } + multival { + if { ![exists_and_not_null current_filter_value] } { + set selected_p 0 + } else { + set selected_p [util_sets_equal_p $current_filter_value $value] + } + } + multivar { + # Value is a list of { key value } lists + # We only check the value whose key matches the filter name + foreach elm $value { + foreach { elm_key elm_value } [lrange $elm 0 1] {} + if { [string equal $elm_key $filter_properties(name)] } { + set selected_p [exists_and_equal current_filter_value $elm_value] + } + } + } + } + + lappend filter_properties(selected_p) $selected_p + set found_selected_p [expr $found_selected_p || $selected_p] + + if { $selected_p } { + # Remember the filter label + set list_properties(filter_label,$filter_properties(name)) $label + } + + # Generate url and add to filter(urls) + switch $filter_properties(type) { + singleval - multival { + lappend filter_properties(urls) [get_url \ + -name $name \ + -override [list [list $filter_properties(var_spec) $value]]] + } + multivar { + # We just use the value-list directly + lappend filter_properties(urls) [get_url \ + -name $name \ + -override $value] + } + } + + # Generate add_url, and add to filter(add_urls) + if { [exists_and_not_null filter_properties(add_url_eval)] } { + upvar $list_properties(ulevel) __filter_value __filter_value + set __filter_value $value + lappend filter_properties(add_urls) [uplevel $list_properties(ulevel) subst $filter_properties(add_url_eval)] + } + } + + # Handle 'other_label' + if { [exists_and_not_null current_filter_value] && \ + !$found_selected_p && \ + ![empty_string_p filter_properties(other_label)] } { + + # Add filter entry with the 'other_label'. + lappend filter_properties(values) [list $filter_properties(other_label) {}] + lappend filter_properties(urls) {} + lappend filter_properties(selected_p) 1 + } + } +} + +ad_proc -private template::list::render_filters { + {-name:required} + {-style ""} +} { + set level [template::adp_level] + + # Provide a reference to the list properties for use by the list template + # Get an upvar'd reference to list_properties + get_reference -name $name + + # + # Create 'filters' multirow + # + + # Manually construct a multirow by setting the relevant variables + set filters:rowcount 0 + template::multirow -local create filters \ + filter_name \ + filter_label \ + filter_clear_url \ + label \ + key_value \ + url \ + url_html_title \ + count \ + add_url \ + selected_p + + foreach filter_ref $list_properties(filter_refs) { + + upvar #$level $filter_ref filter_properties + + if { ![template::util::is_true $filter_properties(hide_p)] } { + + # Loop over 'values' and 'url' simultaneously + foreach elm $filter_properties(values) url $filter_properties(urls) selected_p $filter_properties(selected_p) add_url $filter_properties(add_urls) { + + # 'label' is the first element, 'value' the second + # We do an lrange here, otherwise values would be set wrong + # in case someone accidentally supplies a list with too many elements, + # because then the foreach loop would run more than once + foreach { label value count } [lrange $elm 0 2] {} + + template::multirow -local append filters \ + $filter_properties(name) \ + $filter_properties(label) \ + $filter_properties(clear_url) \ + [string_truncate -len 25 $label] \ + $value \ + $url \ + $label \ + $count \ + $add_url \ + $selected_p + } + } + } + + if { [string equal $style {}] } { + set style [parameter::get \ + -package_id [apm_package_id_from_key "acs-templating"] \ + -parameter DefaultListFilterStyle \ + -default "filters"] + } + set file_stub "[template::get_resource_path]/lists/$style" + + # ensure that the style template has been compiled and is up-to-date + template::adp_init adp $file_stub + + # get result of template output procedure into __adp_output + # the only data source on which this template depends is the "elements" + # multirow data source. The output of this procedure will be + # placed in __adp_output in this stack frame. + + #ns_log Notice "LARS: Code source: [info body template::code::adp::$file_stub]" + + template::code::adp::$file_stub + + return $__adp_output +} + +ad_proc -public template::list::util_html_to_attributes_string { + html +} { + set output {} + foreach { key value } $html { + if { ![empty_string_p $value] } { + append output " [ad_quotehtml $key]=\"[ad_quotehtml $value]\"" + } else { + append output " [ad_quotehtml $key]" + } + } + return $output +} + + + + +##### +# +# template::list::element namespace +# +##### + +ad_proc -public template::list::element::create { + {-list_name:required} + {-element_name:required} + {-spec:required} + {-ulevel 1} +} { + Adds an element to a list builder list. + +

+ + This proc shouldn't be called directly, only through template::list::create. + +

+ + These are the available properties in the spec: + +

+ +

    +
  • + label: The label to use in the header. +
  • +
  • + hide_p: 1 to hide the element from the default display, 0 (default) to show it. +
  • +
  • + aggregate: Aggregate function to use on this column. Can be 'sum', 'average', or 'count'. + The aggregate will be displayed at the bottom of the table. If groupby is used, aggregates for each + group will also be displayed. +
  • +
  • + aggregate_label: The label to use for the aggregate, e.g. "Total". +
  • +
  • + aggregate_group_label: The label to use for the group aggregate, e.g. "Subtotal". +
  • +
  • + html: HTML attributes to be output for the table element, e.g. { align right style "background-color: yellow;" }. + Value should be a Tcl list with { name value name value } +
  • +
  • + display_col: The column to display for this element, if not the column with the same name as the element. +
  • +
  • + display_template: An ADP chunk used to display the element. This overrides all other display options. + You can use @multirow_name.column_name@ to get values of the multirow, and you can directly use the variables + specified in the 'pass_properties' argument to the template::list::create. +
  • +
  • + link_url_col: Name of column in the multirow which contains the URL to which the cell contents should point. + If either link_url_col or link_url_eval is specified, the cell's contents will be made a link to the specified URL, if that + URL is non-empty. +
  • +
  • + link_url_eval: A chunk of Tcl code which will be evaluated in the context of a template::multirow foreach looping over the + dataset multirow, to return the URL to link this cell to. This means that it will have all the columns of the multirow available + as local variables. Example: link_url_eval {[acs_community_member_url -user_id $creation_user]}. +
  • +
  • + link_html: Attributes to be set on the <a> tag of the link generated as a result of link_url_col or link_url_eval. + For example link_html { title "View this user" style "background-color: yellow;" }. + Value should be a Tcl list with { name value name value } +
  • +
  • + csv_col: The column to return in CSV output. +
  • +
  • + sub_class: The second half of the CSS class name. Will be combined with the list's 'main_class' property to form + the full CSS class name with a dash in-between, as in 'main-sub'. +
  • +
  • + class: Alternatively, you can specify full class here, in which case this will override the sub_class property. +
  • +
  • + orderby: The column to use in the order by clause of the query, when sorting by this column. Specifying either this, + or 'orderby_asc' and 'orderby_desc' will cause the table's header to become a hyperlink to sort by that column. +
  • +
  • + orderby_asc: If you want to be able to sort by this column, but sorting ascending and descending is not just a matter of + appending 'asc' or 'desc', you can specify the asc and desc orderby clauses directly. This is useful when you're actually sorting + by two database columns. +
  • +
  • + orderby_desc: The reverse ordering from 'orderby_asc'. +
  • +
  • + default_direction: The default order direction when ordering by this column, 'asc' or 'desc'. +
  • +
+ + @param list_name Name of list. + + @param element_name Name of the element. + + @param spec The spec for this filter. This is an array list of property/value pairs, where the right hand side + is 'subst'ed in the caller's namespace, except for *_eval properties, which are 'subst'ed inside the multirow. + + @param ulevel Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope. +} { + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + # Get the list properties + lappend list_properties(elements) $element_name + + # We store the full element ref name, so its easy to find later + lappend list_properties(element_refs) [get_refname -list_name $list_name -element_name $element_name] + + # Create the element properties array + get_reference -create -list_name $list_name -element_name $element_name + + # Setup element defaults + array set element_properties { + label {} + hide_p 0 + aggregate {} + aggregate_label {} + aggregate_group_label {} + html {} + display_col {} + display_template {} + link_url_col {} + link_url_eval {} + link_html {} + csv_col {} + sub_class {} + class {} + orderby {} + orderby_asc {} + orderby_desc {} + default_direction {} + } + + # These attributes are internal listbuilder attributes + array set element_properties { + subrownum 0 + aggregate_col {} + aggregate_group_col {} + cell_attributes {} + orderby_asc {} + orderby_desc {} + default_direction {} + orderby_url {} + orderby_direction {} + orderby_html_title {} + ordering_p "f" + class {} + } + + # Let the element know its own name + set element_properties(name) $element_name + + # Let the element know its owner's name + set element_properties(list_name) $list_name + + incr ulevel + + set_properties \ + -list_name $list_name \ + -element_name $element_name \ + -spec $spec \ + -ulevel $ulevel + + # Default display_col to element name + if { [empty_string_p $element_properties(display_col)] } { + set element_properties(display_col) $element_properties(name) + } + + # Default csv_col to display_col + if { [empty_string_p $element_properties(csv_col)] } { + set element_properties(csv_col) $element_properties(display_col) + } + + # Default sub_class to list:sub_class + if { [empty_string_p $element_properties(sub_class)] } { + set element_properties(sub_class) $list_properties(sub_class) + } + + # Default class to (list:main_class)-(element:sub_class) + if { [empty_string_p $element_properties(class)] } { + set element_properties(class) [join [concat $list_properties(main_class) $element_properties(sub_class)] "-"] + } + + # Create the orderby filter, if specified + if { ![empty_string_p $element_properties(orderby)] || ![empty_string_p $element_properties(orderby_asc)] || ![empty_string_p $element_properties(orderby_desc)] } { + set orderby_spec [list] + foreach elm { orderby orderby_asc orderby_desc default_direction label } { + if { ![empty_string_p $element_properties($elm)] } { + lappend orderby_spec $elm $element_properties($elm) + } + } + + template::list::orderby::create \ + -list_name $list_name \ + -orderby_name $element_properties(name) \ + -ulevel [expr $ulevel + 1] \ + -spec $orderby_spec + } +} + +ad_proc -public template::list::element::get_refname { + {-list_name:required} + {-element_name:required} +} { + return "$list_name:element:$element_name:properties" +} + +ad_proc -public template::list::element::get_reference { + {-list_name:required} + {-element_name:required} + {-local_name "element_properties"} + {-create:boolean} +} { + # Check that the list exists + template::list::get_reference -name $list_name + + set refname [get_refname -list_name $list_name -element_name $element_name] + + if { !$create_p && ![uplevel \#[template::adp_level] info exists $refname] } { + error "Element '$element_name' not found in list '$list_name'" + } + + uplevel upvar #[template::adp_level] $refname $local_name +} + + +ad_proc -public template::list::element::get_property { + {-list_name:required} + {-element_name:required} + {-property:required} +} { + get_reference \ + -list_name $list_name \ + -element_name $element_name + + return $element_properties($property) +} + +ad_proc -public template::list::element::set_property { + {-list_name:required} + {-element_name:required} + {-property:required} + {-value:required} + {-ulevel 1} +} { + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + get_reference \ + -list_name $list_name \ + -element_name $element_name + + switch $property { + display_eval - link_url_eval { + # This is a chunk of Tcl code, which should be executed later, not now + set element_properties($property) $value + + # Remember that we'll have to do dynamic columns + set list_properties(dynamic_cols_p) 1 + } + aggregate { + # Remember that we'll have to do aggregation + set list_properties(aggregates_p) 1 + + # do an uplevel subst on the value now + set element_properties($property) [uplevel $ulevel [list subst $value]] + } + html { + # All other vars, do an uplevel subst on the value now + set element_properties($property) [uplevel $ulevel [list subst $value]] + set element_properties(cell_attributes) [template::list::util_html_to_attributes_string $element_properties(html)] + } + default { + # We require all properties to be initialized to the empty string in the array, otherwise they're illegal. + if { ![info exists element_properties($property)] } { + error "Unknown element property '$property'. Allowed properties are [join [array names element_properties] ", "]." + } + + # All other vars, do an uplevel subst on the value now + set element_properties($property) [uplevel $ulevel [list subst $value]] + } + } +} + +ad_proc -public template::list::element::set_properties { + {-list_name:required} + {-element_name:required} + {-spec:required} + {-ulevel 1} +} { + incr ulevel + + foreach { property value } $spec { + set_property \ + -list_name $list_name \ + -element_name $element_name \ + -property $property \ + -value $value \ + -ulevel $ulevel + } +} + + + +ad_proc -private template::list::element::render { + {-list_name:required} + {-element_name:required} +} { + Returns an ADP chunk, which must be evaluated +} { + set level [template::adp_level] + + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + #ns_log Notice "LARS: element::render -list_name $list_name -element_name $element_name: upvar #$level $list_name:properties list_properties; list_properties = [array get list_properties], [info exists list_properties]" + + set multirow $list_properties(multirow) + + # Get the element properties + # We ignore if the element doesn't exist, 'cause then we'll just hope it exists in the multirow and display the value directly + get_reference -create -list_name $list_name -element_name $element_name + + if { [exists_and_not_null element_properties(display_template)] } { + set output $element_properties(display_template) + } elseif { [exists_and_not_null element_properties(display_col)] } { + set output "@$multirow.$element_properties(display_col)@" + } else { + set output "@$multirow.$element_name@" + } + + # We have support for making the cell contents a hyperlink right here, because it's so common + set link_url {} + set link_html {} + + if { [exists_and_not_null element_properties(link_url_col)] } { + set link_url "@$multirow.$element_properties(link_url_col)@" + } elseif { [exists_and_not_null element_properties(link_url)] } { + set link_url $element_properties(link_url) + } + + if { [exists_and_not_null element_properties(link_html_col)] } { + set link_html "@$multirow.$element_properties(link_html_col)@" + } elseif { [exists_and_not_null element_properties(link_html)] } { + set link_html $element_properties(link_html) + } + + if { ![empty_string_p $link_url] } { + set old_output $output + + set output "$old_output$old_output" + } + + #ns_log Notice "LARS: element=$element_name, element_properties=[array get element_properties], output=$output" + + return $output +} + + + + + +##### +# +# template::list::filter namespace +# +##### + +ad_proc -public template::list::filter::create { + {-list_name:required} + {-filter_name:required} + {-spec:required} + {-ulevel 1} +} { + Adds a filter to a list builder list. + +

+ + This proc shouldn't be called directly, only through template::list::create. + +

+ + These are the available properties in the spec: + +

+ +

    +
  • + label: The label of the filter. +
  • +
  • + hide_p: Set to 1 to hide this filter from default rendering. +
  • +
  • + type: The type of values this filter sets. Also see 'values' below. Valid options are: 'singleval', meaning that the + value is a single value of a query variable with the name of the filter; 'multival', meaning the the value is really a Tcl list of values, + sent to a :multiple page variable; and 'multivar', meaning that the value is a list of (key value) lists, as in { { var1 value1 } { var2 value 2 } }. + 'multival' is useful when you're filtering on, say, a date range, in which case you'd send two values, namely the start and end date. + 'multivar' is useful when you want the selection of one filter to change the value of another filter, for example when selecting groupby, you also + want to order by the grouped by column, otherwise the groupby won't work properly (you'll get a new group each time the value changes, but it's not sorted + by that column, so you'll get more than one group per value over the entire list). +
  • +
  • + add_url_eval: An expression which will be uplevel subst'ed with a magic + variable __filter_value set to the value of the given filter. +
  • +
  • + values: A list of lists of possible filter values, as in { { label1 value1 count1 } { label2 value2 count2 } ... }. + The 'label' is what's displayed when showing the available filter values. 'value' is what changes filter values, and, depending on 'type' above, + can either be a single value, a list of values, or a list of ( name value ) pairs. 'count' is optional, and is the number of rows that match the + given filter value. +
  • +
  • + has_default_p: If set to 1, it means that this filter has a default value, and thus cannot be cleared. If not set, the list builder will automatically + provide a link to clear the currently selected value of this filter. You only need to set this if you specify a default value in your page's ad_page_contract, + instead of through the 'default_value' property below. +
  • +
  • + default_value: The default value to use when no value is selected for this filter. Automatically sets has_default_p to 1. +
  • +
  • + where_clause: What should go in the where clause of your query when + filtering on this filter. For example "l.project_id = :project_id". +
  • +
  • + where_clause_eval: Same as where_clause, except this gets evaluated in the caller's context. +
  • +
  • + other_label: If your values above do not carry all possible values, we can display a special + 'other' value when some other value is selected for this filter. You specify here what label should + be used for that element. +
  • +
+ +

+ + In order for filters to work, you have to specify them in your page's ad_page_contract, typically as filter_name:optional. The list builder will find them from there, + by grabbing them from your page's local variables. + + @param list_name Name of list. + + @param filter_name Name of the filter. + + @param spec The spec for this filter. This is an array list of property/value pairs, where the right hand side + is 'subst'ed in the caller's namespace, except for *_eval properties, which are 'subst'ed inside the multirow. + + @param ulevel Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope. +} { + set level [template::adp_level] + + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + # Remember the filters and their order + lappend list_properties(filters) $filter_name + + # Properties are going to be stored in an array named 'list-name:filter:filter-name:properties' + set filter_ref "$list_name:filter:$filter_name:properties" + + # We also store the full filter array name, so its easy to find < + lappend list_properties(filter_refs) $filter_ref + + # Upvar the filter properties array + upvar #$level $filter_ref filter_properties + + # Setup filter defaults + array set filter_properties { + label {} + hide_p 0 + type singleval + add_url_eval {} + values {} + has_default_p 0 + default_value {} + where_clause {} + where_clause_eval {} + other_label {} + } + + # Prepopulate some automatically generated values + array set filter_properties { + clear_url {} + urls {} + add_urls {} + selected_p {} + } + + # Let the filter know its own name + set filter_properties(name) $filter_name + + # Let the filter know its owner's name + set filter_properties(list_name) $list_name + + set_properties \ + -list_name $list_name \ + -filter_name $filter_name \ + -spec $spec \ + -ulevel [expr $ulevel + 1] + + # This is to be used by the export_vars function + switch $filter_properties(type) { + singleval - multivar { + set filter_properties(var_spec) $filter_name + } + multival { + set filter_properties(var_spec) "${filter_name}:multiple" + } + } + lappend list_properties(filters_export) $filter_properties(var_spec) +} + +ad_proc -public template::list::filter::get_refname { + {-list_name:required} + {-filter_name:required} +} { + return "$list_name:filter:$filter_name:properties" +} + +ad_proc -public template::list::filter::get_reference { + {-list_name:required} + {-filter_name:required} + {-local_name "filter_properties"} + {-create:boolean} +} { + set refname [get_refname -list_name $list_name -filter_name $filter_name] + + if { !$create_p && ![uplevel \#[template::adp_level] info exists $refname] } { + error "Filter '$filter_name' not found" + } + + uplevel upvar #[template::adp_level] $refname $local_name +} + +ad_proc -public template::list::filter::set_property { + {-list_name:required} + {-filter_name:required} + {-property:required} + {-value:required} + {-ulevel 1} +} { + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + get_reference \ + -list_name $list_name \ + -filter_name $filter_name + + switch $property { + where_clause_eval - add_url_eval { + # Eval's shouldn't be subst'ed here, will be later + set filter_properties($property) $value + } + default_value { + set value [uplevel $ulevel [list subst $value]] + set filter_properties($property) $value + if { ![empty_string_p $value] } { + set filter_properties(has_default_p) 1 + } + } + default { + # We require all properties to be initialized to the empty string in the array, otherwise they're illegal. + if { ![info exists filter_properties($property)] } { + error "Unknown filter property '$property'. Allowed properties are [join [array names filter_properties] ", "]." + } + + # All other vars, do an uplevel subst on the value now + set value [uplevel $ulevel [list subst $value]] + set filter_properties($property) $value + } + } +} + +ad_proc -public template::list::filter::set_properties { + {-list_name:required} + {-filter_name:required} + {-spec:required} + {-ulevel 1} +} { + incr ulevel + + foreach { property value } $spec { + set_property \ + -list_name $list_name \ + -filter_name $filter_name \ + -property $property \ + -value $value \ + -ulevel $ulevel + } +} + + +ad_proc -public template::list::filter::get_property { + {-list_name:required} + {-filter_name:required} + {-property:required} +} { + get_reference \ + -list_name $list_name \ + -filter_name $filter_name + + return $filter_properties($property) +} + +ad_proc -public template::list::filter::exists_p { + {-list_name:required} + {-filter_name:required} +} { + set refname [get_refname -list_name $list_name -filter_name $filter_name] + + return [uplevel \#[template::adp_level] info exists $refname] +} + + + + +##### +# +# template::list::format namespace +# +##### + +ad_proc -public template::list::format::create { + {-list_name:required} + {-format_name:required} + {-selected_format ""} + {-spec:required} + {-ulevel 1} +} { + Adds a format to a list builder list. + +

+ + This proc shouldn't be called directly, only through template::list::create. + +

+ + These are the available properties in the spec: + +

+ +

    +
  • + label: The label. +
  • +
  • + layout: The layout, can be 'table' or 'list'. +
  • +
  • + style: The name of the template to used to render this format. Defaults to the name of the layout, and can be overridden in the ADP file. +
  • +
  • + output: Output format, can be either 'template' or 'csv'. If 'csv'. then the output is streamed directly to the browser + and not through the templating system, but you have to call + template::list::write_output from your page to make this work. +
  • +
  • + page_size: The page size for this format. Leave blank to use the list's page size. +
  • +
  • + elements: 'table' layout: An ordered list of elements to display in this format. +
  • +
  • + row: 'table' layout: For more complex table layout, you can specify each row individually. The value is an array-list of ( element_name spec ) pairs. + You can have more than one 'row' property, in which case your output table will have more than one HTML table row per row in the data set. + In the 'spec' part of each element listed in the row, you can specify properties that override the properties defined in the -elements section + of template::list::create, thus changing the label, link, display_col, etc. +
  • +
  • + template: 'list' layout: An ADP chunk to be used for display of each row of the list. Use + <listelement name="element_name"> to output a list element in your template. + +
  • +
+ + + @param list_name Name of list. + + @param format_name Name of the format. + + @param spec The spec for this format. This is an array list of property/value pairs, where the right hand side + is 'subst'ed in the caller's namespace, except for *_eval properties, which are 'subst'ed inside the multirow. + + @param ulevel Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope. +} { + set level [template::adp_level] + + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + # Remember the formats and their order + lappend list_properties(formats) $format_name + + # Properties are going to be stored in an array named 'list-name:format:format-name:properties' + set format_ref "$list_name:format:$format_name:properties" + + # We also store the full format array name, so its easy to find < + lappend list_properties(format_refs) $format_ref + + # Upvar the format properties array + upvar #$level $format_ref format_properties + + # Setup format defaults + array set format_properties { + label {} + layout table + style {} + output template + page_size {} + elements {} + row {} + template {} + } + + # Let the format know its own name + set format_properties(name) $format_name + + # Let the format know its owner's name + set format_properties(list_name) $list_name + + # Counting the row number within one row of the dataset + set subrownum 0 + set elementnum 0 + + foreach { key value } $spec { + switch $key { + row { + # We only care about this for the currently selected format + if { [string equal $format_name $selected_format] } { + + # This is the layout specification for table layouts + set value [uplevel $ulevel [list subst $value]] + incr subrownum + + foreach { element_name spec } $value { + incr elementnum + + template::list::element::get_reference \ + -list_name $list_name \ + -element_name $element_name + + # Set elementnum and subrownum + set element_properties(elementnum) $elementnum + set element_properties(subrownum) $subrownum + + # Set/override additional element properties from the spec + template::list::element::set_properties \ + -list_name $list_name \ + -element_name $element_name \ + -spec $spec \ + -ulevel [expr $ulevel + 1] + + # Remember the display order + lappend list_properties(display_elements) $element_name + } + } + } + template { + # We only care about this for the currently selected format + if { [string equal $format_name $selected_format] } { + # All other vars, do an uplevel subst on the value now + set value [uplevel $ulevel [list subst $value]] + set format_properties($key) $value + set list_properties(row_template) $value + } + } + default { + # We require all properties to be initialized to the empty string in the array, otherwise they're illegal. + if { ![info exists format_properties($key)] } { + error "Unknown format property '$key'. Allowed properties are [join [array names format_properties] ", "]." + } + + # All other vars, do an uplevel subst on the value now + set format_properties($key) [uplevel $ulevel [list subst $value]] + } + } + } + + # For the currently selected format, copy some things over to the list properties + if { [string equal $format_name $selected_format] } { + if { [empty_string_p $format_properties(style)] } { + set format_properties(style) $format_properties(layout) + } + + # Move style up to the list_properties + if { ![empty_string_p $format_properties(style)] } { + set list_properties(style) $format_properties(style) + } + + # Move output up to the list_properties + if { ![empty_string_p $format_properties(output)] } { + set list_properties(output) $format_properties(output) + } + + # Move page_size up to the list_properties + if { ![empty_string_p $format_properties(page_size)] } { + set list_properties(page_size) $format_properties(page_size) + } + + # Move elements up to the list_properties as display_elements + if { ![empty_string_p $format_properties(elements)] } { + set list_properties(display_elements) $format_properties(elements) + } + + } + + return [list $format_properties(label) $format_name] +} + + + + + + +##### +# +# template::list::orderby namespace +# +##### + +ad_proc -public template::list::orderby::create { + {-list_name:required} + {-orderby_name:required} + {-spec:required} + {-ulevel 1} +} { + Adds an orderby to a list builder list. + +

+ + This proc shouldn't be called directly, only through template::list::create. + +

+ + These are the available properties in the spec: + +

+ +

    +
  • + label: The label for the orderby. +
  • +
  • + orderby: The column to use in the order by clause of the query. If it's not as simple as that, you can also specify + 'orderby_asc' and 'orderby_desc' separately. +
  • +
  • + orderby_asc: The orderby clause when sorting ascending. This is useful when you're actually sorting + by two database columns. +
  • +
  • + orderby_desc: The reverse ordering from 'orderby_asc'. +
  • +
  • + default_direction: The default order direction, 'asc' or 'desc'. Defaults to 'asc'. +
  • +
+ + @param list_name Name of list. + + @param orderby_name Name of the orderby. + + @param spec The spec for this orderby. This is an array list of property/value pairs, where the right hand side + is 'subst'ed in the caller's namespace, except for *_eval properties, which are 'subst'ed inside the multirow. + + @param ulevel Where we should uplevel to when doing the subst's. Defaults to '1', meaning the caller's scope. +} { + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + # Get the list properties + lappend list_properties(orderbys) $orderby_name + + # We store the full element ref name, so its easy to find later + lappend list_properties(orderby_refs) [get_refname -list_name $list_name -orderby_name $orderby_name] + + # Create the orderby properties array + get_reference -create -list_name $list_name -orderby_name $orderby_name + + # Setup element defaults + array set orderby_properties { + label {} + orderby_desc {} + orderby_asc {} + orderby {} + default_direction asc + } + + # These attributes are internal listbuilder attributes + array set orderby_properties { + } + + # Let the orderby know its own name + set orderby_properties(name) $orderby_name + + # Let the orderby know its owner's name + set orderby_properties(list_name) $list_name + + incr ulevel + + set_properties \ + -list_name $list_name \ + -orderby_name $orderby_name \ + -spec $spec \ + -ulevel $ulevel + + # Set the orderby properties of the element with the same name, if any + template::list::element::get_reference -create -list_name $list_name -element_name $orderby_name + if { [info exists element_properties] } { + set element_properties(orderby_asc) $orderby_properties(orderby_asc) + set element_properties(orderby_desc) $orderby_properties(orderby_desc) + set element_properties(default_direction) $orderby_properties(default_direction) + } + + # Create the 'orderby' filter if it doesn't already exist + if { ![template::list::filter::exists_p -list_name $list_name -filter_name $list_properties(orderby_name)] } { + template::list::filter::create \ + -list_name $list_name \ + -filter_name $list_properties(orderby_name) \ + -spec { + label "Sort order" + } \ + -ulevel 2 + } + + template::list::filter::get_reference \ + -list_name $list_name \ + -filter_name $list_properties(orderby_name) + + lappend filter_properties(values) [list $orderby_properties(label) "${orderby_name},$orderby_properties(default_direction)"] + + # Return an element which can be put into the 'values' property of a filter + return [list $orderby_properties(label) "${orderby_name},$orderby_properties(default_direction)"] +} + +ad_proc -public template::list::orderby::get_refname { + {-list_name:required} + {-orderby_name:required} +} { + return "$list_name:orderby:$orderby_name:properties" +} + +ad_proc -public template::list::orderby::get_reference { + {-list_name:required} + {-orderby_name:required} + {-local_name "orderby_properties"} + {-create:boolean} +} { + # Check that the list exists + template::list::get_reference -name $list_name + + set refname [get_refname -list_name $list_name -orderby_name $orderby_name] + + if { !$create_p && ![uplevel #[template::adp_level] info exists $refname] } { + error "Orderby '$orderby_name' not found in list '$list_name'" + } + + uplevel upvar #[template::adp_level] $refname $local_name +} + +ad_proc -public template::list::orderby::get_property { + {-list_name:required} + {-orderby_name:required} + {-property:required} +} { + get_reference \ + -list_name $list_name \ + -orderby_name $orderby_name + + return $orderby_properties($property) +} + +ad_proc -public template::list::orderby::set_property { + {-list_name:required} + {-orderby_name:required} + {-property:required} + {-value:required} + {-ulevel 1} +} { + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + get_reference \ + -list_name $list_name \ + -orderby_name $orderby_name + + switch $property { + orderby { + set value [uplevel $ulevel [list subst $value]] + set orderby_properties($property) $value + set orderby_properties(orderby_asc) "$value asc" + set orderby_properties(orderby_desc) "$value desc" + } + default { + # We require all properties to be initialized to the empty string in the array, otherwise they're illegal. + if { ![info exists orderby_properties($property)] } { + error "Unknown orderby property '$property'. Allowed properties are [join [array names orderby_properties] ", "]." + } + + # All other vars, do an uplevel subst on the value now + set orderby_properties($property) [uplevel $ulevel [list subst $value]] + } + } +} + +ad_proc -public template::list::orderby::set_properties { + {-list_name:required} + {-orderby_name:required} + {-spec:required} + {-ulevel 1} +} { + incr ulevel + + foreach { property value } $spec { + set_property \ + -list_name $list_name \ + -orderby_name $orderby_name \ + -property $property \ + -value $value \ + -ulevel $ulevel + } +} + + + + + + +##### +# +# Templating system ADP tags +# +##### + + + +template_tag listtemplate { chunk params } { + + set level [template::adp_level] + + set list_name [template::get_attribute listtemplate $params name] + + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + set style [ns_set iget $params style] + + template::adp_append_string \ + "\[[list template::list::render -name $list_name -style $style]\]" +} + +template_tag listelement { params } { + + set element_name [template::get_attribute listelement $params name] + + template::adp_append_string \ + "\[template::list::element::render -list_name \${list_properties(name)} -element_name $element_name\]" +} + +template_tag listrow { params } { + + set level [template::adp_level] + + template::adp_append_string \ + "\[template::list::render_row -name \${list_properties(name)}\]" +} + +template_tag listfilters { chunk params } { + set level [template::adp_level] + + set list_name [template::get_attribute listfilters $params name] + + # Get an upvar'd reference to list_properties + template::list::get_reference -name $list_name + + set style [ns_set iget $params style] + + template::adp_append_string \ + "\[[list template::list::render_filters -name $list_name -style $style]\]" +} Index: openacs-4/packages/acs-templating/tcl/paginator-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/paginator-procs.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/acs-templating/tcl/paginator-procs.tcl 17 May 2003 10:05:27 -0000 1.11 +++ openacs-4/packages/acs-templating/tcl/paginator-procs.tcl 28 Aug 2003 09:41:45 -0000 1.12 @@ -16,19 +16,21 @@ @see template::paginator @see template::paginator::create @see template::paginator::get_context - @see template::paginator::get_data + @see template::paginator::get_data + @see template::paginator::get_query @see template::paginator::get_display_info @see template::paginator::get_group @see template::paginator::get_group_count @see template::paginator::get_groups @see template::paginator::get_page @see template::paginator::get_page_count @see template::paginator::get_pages - @see template::paginator::get_pages_info + @see template::paginator::get_pages_info @see template::paginator::get_row @see template::paginator::get_row_count @see template::paginator::get_row_ids @see template::paginator::get_row_last + @see template::paginator::reset } { eval paginator::$command $args } @@ -46,7 +48,7 @@ the results. Bind variables may be used. @option timeout The lifetime of a query result in seconds, after which - the query must be refreshed. + the query must be refreshed (if not reset). @option pagesize The number of rows to display on a single page. @@ -80,8 +82,57 @@ set cache_key $name:$query set row_ids [cache get $cache_key:row_ids] - if { [string equal $row_ids {}] } { - init $statement_name $name $query + if { ([string equal $row_ids {}] && ![nsv_exists __template_cache_timeout $cache_key]) || ([info exists opts(flush_p)] && [string equal $opts(flush_p) "t"]) } { + if { [info exists opts(printing_prefs)] && ![empty_string_p $opts(printing_prefs)] } { + ReturnHeadersNoCache "text/html" + ns_write " + +" + set title [lindex $opts(printing_prefs) 0] + ns_write "$title + " + set stylesheet [lindex $opts(printing_prefs) 1] + if { ![empty_string_p $stylesheet] } { + ns_write "" + } + ns_write "" + ns_write "" + set header_file [lindex $opts(printing_prefs) 3] + if { ![empty_string_p $header_file] } { + ns_write [ns_adp_parse -file $header_file] + } + ns_write [lindex $opts(printing_prefs) 6] + init $statement_name $name $query 1 + ns_write [lindex $opts(printing_prefs) 7] + set footer_file [lindex $opts(printing_prefs) 4] + if { ![empty_string_p $footer_file] } { + ns_write [ns_adp_parse -file $footer_file] + } + set return_url [lindex $opts(printing_prefs) 5] + if { ![empty_string_p $return_url] } { + if { [llength $opts(row_ids)]==0 } { + nsv_set __template_cache_timeout $cache_key $opts(timeout) + } + ns_write " + + " + } + ns_write [ad_footer] + ad_script_abort + } else { + init $statement_name $name $query + } } else { set opts(row_ids) $row_ids set opts(context_ids) [cache get $cache_key:context_ids] @@ -92,21 +143,55 @@ set opts(group_count) [get_group $name $opts(page_count)] } -ad_proc -private template::paginator::init { statement_name name query } { +ad_proc -private template::paginator::init { statement_name name query {print_p 0} } { Initialize a paginated query. Only called by create. } { get_reference # query for an ordered list of all row identifiers to cache # perform the query in the calling scope so bind variables have effect - upvar 3 __paginator_ids ids + upvar 2 __paginator_ids ids + set ids [list] if { [info exists properties(contextual)] } { # query contains two columns, one for ID and one for context cue - uplevel 3 "set __paginator_ids \[db_list_of_lists $statement_name \"$query\"\]" + uplevel 2 " + set full_statement_name \[db_qd_get_fullname $statement_name\] + + # Can't use db_foreach here, since we need to use the ns_set directly. + db_with_handle db { + set selection \[db_exec select \$db \$full_statement_name {$query}\] + + set __paginator_ids \[list\] + set total_so_far 1 + + while { \[db_getrow \$db \$selection\] } { + set this_result \[list\] + for { set i 0 } { \$i < \[ns_set size \$selection\] } { incr i } { + lappend this_result \[ns_set value \$selection \$i\] + } + if { $print_p } { + if { \$total_so_far % 250 == 0 } { + ns_write \"…\$total_so_far \" + } + if { \$total_so_far % 3000 == 0 } { + ns_write \"
\" + } + } + incr total_so_far + lappend __paginator_ids \$this_result + } + + if { $print_p } { + ns_write \"…\[expr \$total_so_far - 1\]\" + } + + } + " + set i 0 set page_size $properties(pagesize) set context_ids [list] @@ -120,7 +205,7 @@ } incr i } - + set properties(context_ids) $context_ids cache set $name:$query:context_ids $context_ids $properties(timeout) @@ -130,14 +215,41 @@ } set properties(row_ids) $row_ids + cache set $name:$query:row_ids $row_ids $properties(timeout) - } else { - # no extra column specified for paging by contextual cues - uplevel 3 "set __paginator_ids \[db_list $statement_name \"$query\"\]" + uplevel 2 " + # Can't use db_foreach here, since we need to use the ns_set directly. + db_with_handle db { + set selection \[db_exec select \$db $statement_name \"$query\"\] + set __paginator_ids \[list\] + set total_so_far 1 + + while { \[db_getrow \$db \$selection\] } { + set this_result \[list\] + for { set i 0 } { \$i < \[ns_set size \$selection\] } { incr i } { + lappend this_result \[ns_set value \$selection \$i\] + } + if { $print_p } { + if { \$total_so_far % 250 == 0 } { + ns_write \"...\$total_so_far \" + } + if { \$total_so_far % 3000 == 0 } { + ns_write \"
\" + } + } + incr total_so_far + lappend __paginator_ids \$this_result + } + if { $print_p } { + ns_write \"...\[expr \$total_so_far - 1\]\" + } + } + " + set properties(row_ids) $ids cache set $name:$query:row_ids $ids $properties(timeout) } @@ -243,6 +355,19 @@ return $ids } +ad_proc -public template::paginator::get_all_row_ids { name } { + Gets a list of IDs in the master ID list + generated by the initial query submitted for pagination. IDs are + typically primary key values. + + @param name The reference to the paginator object. + + @return A Tcl list of row identifiers. +} { + get_reference + return $properties(row_ids) +} + ad_proc -public template::paginator::get_pages { name group } { Gets a list of pages in a group, truncating if appropriate at the end. @@ -268,7 +393,7 @@ set start [expr ($group - 1) * $group_size + 1] set end [expr $start + $group_size] - if { $end > $page_count } { set end $page_count } + if { $end > $page_count } { set end [expr $page_count] } set pages [list] @@ -344,6 +469,9 @@ upvar 2 $datasource:rowcount rowcount set rowcount 0 + upvar 2 $datasource:columns columns + set columns { page context } + foreach page $pages { incr rowcount @@ -376,6 +504,9 @@ upvar 2 $datasource:rowcount rowcount set rowcount 0 + upvar 2 $datasource:columns columns + set columns { page } + foreach page $pages { incr rowcount @@ -458,10 +589,28 @@ get_reference upvar 2 $datasource info + if { $page > $properties(page_count) } { + set page $properties(page_count) + } + + set group [get_group $name $page] + set groupsize $properties(groupsize) + set info(page_count) $properties(page_count) + set info(group_count) $properties(group_count) + set info(current_page) $page + set info(current_group) $group - array set info [list next_page {} previous_page {} \ - next_group {} previous_group {}] + array set info { + next_page {} + previous_page {} + next_group {} + previous_group {} + next_page_context {} + previous_page_context {} + next_group_context {} + previous_group_context {} + } if { $page > 1 } { set info(previous_page) [expr $page - 1] @@ -471,8 +620,6 @@ set info(next_page) [expr $page + 1] } - set group [get_group $name $page] - set groupsize $properties(groupsize) if { $group > 1 } { set info(previous_group) [expr ($group - 2) * $groupsize + 1] @@ -481,6 +628,15 @@ if { $group < $properties(group_count) } { set info(next_group) [expr $group * $groupsize + 1] } + + # If the paginator is contextual, set the context + if { [info exists properties(context_ids)] } { + foreach elm { next_page previous_page next_group previous_group } { + if { [exists_and_not_null info($elm)] } { + set info(${elm}_context) [lindex $properties(context_ids) [expr $info($elm) -1]] + } + } + } } ad_proc -public template::paginator::get_data { statement_name name datasource query id_column page } { @@ -505,7 +661,9 @@ template::util::list_to_lookup $ids row_order # substitute the current page set - set query [uplevel 2 "db_map ${statement_name}_partial"] + if { [empty_string_p $query] } { + set query [uplevel 2 "db_map ${statement_name}_partial"] + } # DEDS: quote the ids so that we are not # necessarily limited to integer keys @@ -558,6 +716,57 @@ } +ad_proc -public template::paginator::get_query { name id_column page } { + Returns a query with the data for the rows on the current page. + + @param name The reference to the paginator object. + @param query The query to execute, containing IN (CURRENT_PAGE_SET). + @param id_column The name of the ID column in the display query (required + to order rows properly). +} { + set ids [get_row_ids $name $page] + + if { ![empty_string_p $ids] } { + # calculate the base row number for the page + upvar 2 __page_firstrow firstrow + set firstrow [get_row $name $page] + + # build a hash of row order to order the rows on the page + upvar 2 __page_order row_order + template::util::list_to_lookup $ids row_order + + set query "CURRENT_PAGE_SET" + + # DEDS: quote the ids so that we are not + # necessarily limited to integer keys + set quoted_ids [list] + foreach one_id $ids { + lappend quoted_ids "'[DoubleApos $one_id]'" + } + set in_list [join $quoted_ids ","] + if { ! [regsub CURRENT_PAGE_SET $query $in_list query] } { + error "Token CURRENT_PAGE_SET not found." + } + + if { [llength $in_list] == 0 } { + uplevel 2 "set $datasource:rowcount 0" + return + } + + # Return the query with CURRENT_PAGE_SET slugged + return $query + } else { + return "null" + } +} + +ad_proc -public template::paginator::reset { name query } { + Resets the cache for a query. +} { + cache flush $name:$query:context_ids + cache flush $name:$query:row_ids +} + ad_proc -private template::paginator::get_reference {} { Get a reference to the paginator properties (internal helper) } { Index: openacs-4/packages/acs-templating/tcl/query-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/query-procs.tcl,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/acs-templating/tcl/query-procs.tcl 17 May 2003 10:05:27 -0000 1.13 +++ openacs-4/packages/acs-templating/tcl/query-procs.tcl 28 Aug 2003 09:41:45 -0000 1.14 @@ -673,7 +673,7 @@ } extend { - upvar $name:columns columns + upvar $multirow_level_up $name:columns columns foreach column_name $args { lappend columns $column_name } Index: openacs-4/packages/acs-templating/tcl/tag-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/tag-init.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/acs-templating/tcl/tag-init.tcl 17 May 2003 10:05:27 -0000 1.10 +++ openacs-4/packages/acs-templating/tcl/tag-init.tcl 28 Aug 2003 09:41:45 -0000 1.11 @@ -218,7 +218,7 @@ set ${name}(groupnum_last_p) 1 } else { upvar 0 ${name}:\[expr \$$i + 1\] $name:next - set ${name}(groupnum_last_p) \[expr !\[string equal \${${name}:next($column)} \$${name}($column)\]\] + set ${name}(groupnum_last_p) \[expr !\[string equal \[set \"${name}:next(${column})\"\] \$${name}($column)\]\] } " @@ -231,7 +231,7 @@ break } upvar 0 ${name}:\[expr \$$i + 1\] $name:next - if { !\[string equal \${${name}:next($column)} \$${name}($column)\] } { + if { !\[string equal \[set \"${name}:next(${column})\"\] \$${name}(${column})\] } { break } incr $i Index: openacs-4/packages/acs-templating/tcl/tag-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/tag-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/acs-templating/tcl/tag-procs.tcl 23 Aug 2003 00:26:26 -0000 1.8 +++ openacs-4/packages/acs-templating/tcl/tag-procs.tcl 28 Aug 2003 09:41:45 -0000 1.9 @@ -156,11 +156,16 @@ } nil { - # substitute array variables - regsub {^"@([a-zA-z0-9_]+)\.([a-zA-z0-9_]+)@"$} $arg1 {\1(\2)} arg1 - # substitute regular variables - regsub {^"@([a-zA-z0-9_:]+)@"$} $arg1 {\1} arg1 - append condition "\[template::util::is_nil $arg1\]" + if { [string first @ $arg1] == -1 } { + # We're assuming this is a static string, not a variable + append condition "\[empty_string_p $arg1\]" + } else { + # substitute array variables + regsub {^"@([a-zA-z0-9_]+)\.([a-zA-z0-9_]+)@"$} $arg1 {\1(\2)} arg1 + # substitute regular variables + regsub {^"@([a-zA-z0-9_:]+)@"$} $arg1 {\1} arg1 + append condition "\[template::util::is_nil $arg1\]" + } set next $i } Index: openacs-4/packages/acs-templating/tcl/widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/widget-procs.tcl,v diff -u -N -r1.20 -r1.21 --- openacs-4/packages/acs-templating/tcl/widget-procs.tcl 19 May 2003 12:30:32 -0000 1.20 +++ openacs-4/packages/acs-templating/tcl/widget-procs.tcl 28 Aug 2003 09:41:45 -0000 1.21 @@ -30,6 +30,7 @@ @see template::widget::numericRange @see template::widget::password @see template::widget::radio + @see template::util::richtext @see template::widget::search @see template::widget::select @see template::widget::submit @@ -239,6 +240,21 @@ return [input submit element $tag_attributes] } +ad_proc -public template::widget::attachment { element_reference tag_attributes } { + + upvar $element_reference element + + set output [input file element $tag_attributes] + + set element(name) $element(attach_name) + set element(label) $element(attach_label) + set element(html) $element(attach_html) + + append output [submit element $tag_attributes] + + return $output +} + ad_proc -public template::widget::checkbox { element_reference tag_attributes } { upvar $element_reference element @@ -378,7 +394,9 @@ if { [string equal $value {}] } { return [list] } if { [string equal $value ":search:"] } { - unset element(options) + if { [info exists element(options)] } { + unset element(options) + } template::element::set_error $element(form_id) $element_id " Please enter a search string." return [list] @@ -402,7 +420,9 @@ # no search results so return text entry back to the user - unset element(options) + if { [info exists element(options)] } { + unset element(options) + } template::element::set_error $element(form_id) $element_id " No matches were found for \"$value\".
Please Index: openacs-4/packages/attachments/catalog/attachments.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/catalog/attachments.en_US.ISO-8859-1.xml,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/attachments/catalog/attachments.en_US.ISO-8859-1.xml 24 Jun 2003 12:01:29 -0000 1.8 +++ openacs-4/packages/attachments/catalog/attachments.en_US.ISO-8859-1.xml 28 Aug 2003 09:41:45 -0000 1.9 @@ -19,7 +19,7 @@ %contents.content_size% byte Created by the attachments packge document to %pretty_object_name%. - don't know how to deal with this attachment type + Don't know how to deal with attachment type %content_type% Error: Attachment root folder and fs root folder different! Error: empty folder_id! Folder %folder_name% is empty Index: openacs-4/packages/attachments/tcl/attachments-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/tcl/Attic/attachments-procs-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/attachments/tcl/attachments-procs-oracle.xql 30 Aug 2002 14:44:08 -0000 1.2 +++ openacs-4/packages/attachments/tcl/attachments-procs-oracle.xql 28 Aug 2003 09:41:46 -0000 1.3 @@ -4,8 +4,7 @@ - select item_id, - acs_object.name(item_id) + select item_id from attachments where object_id = :object_id and approved_p = 't' @@ -15,7 +14,6 @@ select item_id, - acs_object.name(item_id), approved_p from attachments where object_id = :object_id Index: openacs-4/packages/attachments/tcl/attachments-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/tcl/attachments-procs.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/attachments/tcl/attachments-procs.tcl 7 Nov 2002 15:11:49 -0000 1.10 +++ openacs-4/packages/attachments/tcl/attachments-procs.tcl 28 Aug 2003 09:41:46 -0000 1.11 @@ -144,9 +144,14 @@ set lst [db_list_of_lists select_attachments {}] set lst_with_urls [list] - foreach el $lst { - set append_lst [list [goto_attachment_url -object_id $object_id -attachment_id [lindex $el 0] -base_url $base_url]] - lappend lst_with_urls [concat $el $append_lst] + foreach item_id $lst { + if { [content_extlink::extlink_p -item_id $item_id] } { + set label [content_extlink::extlink_name -item_id $item_id] + } else { + set label [fs::get_object_name -object_id $item_id] + } + set append_lst [list [goto_attachment_url -object_id $object_id -attachment_id $item_id -base_url $base_url]] + lappend lst_with_urls [concat [list $item_id $label] $append_lst] } return $lst_with_urls @@ -161,9 +166,14 @@ set lst [db_list_of_lists select_attachments {}] set lst_with_urls [list] - foreach el $lst { - set append_lst [list [goto_attachment_url -object_id $object_id -attachment_id [lindex $el 0] -base_url $base_url]] - lappend lst_with_urls [concat $el $append_lst] + foreach item_id $lst { + if { [content_extlink::extlink_p -item_id $item_id] } { + set label [content_extlink::extlink_name -item_id $item_id] + } else { + set label [fs::get_object_name -object_id $item_id] + } + set append_lst [list [goto_attachment_url -object_id $object_id -attachment_id $item_id -base_url $base_url]] + lappend lst_with_urls [concat [list $item_id $label] $append_lst] } return $lst_with_urls Index: openacs-4/packages/attachments/www/go-to-attachment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/go-to-attachment.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/attachments/www/go-to-attachment.tcl 17 May 2003 10:13:01 -0000 1.5 +++ openacs-4/packages/attachments/www/go-to-attachment.tcl 28 Aug 2003 09:41:46 -0000 1.6 @@ -12,27 +12,28 @@ permission::require_permission -object_id $object_id -privilege read # Get information about attachment -if {![db_0or1row select_attachment_data {}]} { - ad_return_complaint "[_ attachments.lt_No_such_attachment_fo]" +set content_type [item::get_type $attachment_id] +if { [string length $content_type] == 0 } { + ad_return_complaint 1 [_ attachments.lt_No_such_attachment_fo] return } -switch $object_type { +switch $content_type { content_extlink { ad_returnredirect [db_string select_url {}] ad_script_abort return } - content_item { + file_storage_object { set title [db_string select_attachment_title {}] ad_returnredirect "download/[ad_urlencode $title]?object_id=$object_id&attachment_id=$attachment_id" ad_script_abort return } default { - ad_return_complaint "[_ attachments.lt_dont_know_how_to_deal]" + ad_return_complaint 1 [_ attachments.lt_dont_know_how_to_deal [list content_type $content_type]] return } } Index: openacs-4/packages/attachments/www/go-to-attachment.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/go-to-attachment.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/attachments/www/go-to-attachment.xql 17 May 2003 10:13:02 -0000 1.3 +++ openacs-4/packages/attachments/www/go-to-attachment.xql 28 Aug 2003 09:41:46 -0000 1.4 @@ -1,17 +1,6 @@ - - - select object_type - from attachments, acs_objects - where - attachments.object_id = :object_id and - attachments.item_id = :attachment_id and - attachments.item_id = acs_objects.object_id - - - select url Index: openacs-4/packages/attachments/www/simple-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/simple-add-2.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/attachments/www/simple-add-2.tcl 17 May 2003 10:13:02 -0000 1.3 +++ openacs-4/packages/attachments/www/simple-add-2.tcl 28 Aug 2003 09:41:46 -0000 1.4 @@ -24,11 +24,13 @@ ad_require_permission $folder_id write db_transaction { - - # Create and attach the URL - attachments::attach -object_id $object_id \ - -attachment_id [content_simple::new -url $url -label $title -description $description -parent_id $folder_id] + # Create the URL (for now) + set url_id [content_extlink::new -url $url -label $title -description $description -parent_id $folder_id] + + # Attach the URL + attachments::attach -object_id $object_id -attachment_id $url_id + } ad_returnredirect "$return_url" Index: openacs-4/packages/bug-tracker/bug-tracker.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/bug-tracker.info,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/bug-tracker/bug-tracker.info 14 Apr 2003 13:33:29 -0000 1.12 +++ openacs-4/packages/bug-tracker/bug-tracker.info 28 Aug 2003 09:45:29 -0000 1.13 @@ -7,18 +7,22 @@ f f - + + + postgresql + oracle + Lars Pind Tracks bugs and features, versions and maintainers, in software projects. Contains the best of SDM, Bugzilla, FogBUGZ, and bughost.com. 2003-02-28 Musea Technologies - + - + - + @@ -27,6 +31,7 @@ + Index: openacs-4/packages/bug-tracker/lib/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/lib/master.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/bug-tracker/lib/master.adp 22 May 2003 14:23:42 -0000 1.5 +++ openacs-4/packages/bug-tracker/lib/master.adp 28 Aug 2003 09:45:29 -0000 1.6 @@ -1,10 +1,13 @@ -@title;noquote@ +@title@ -@signatory;noquote@ -@focus;noquote@ +@signatory@ +@focus@ /packages/bug-tracker/lib/version-bar - @context_bar;noquote@ + @context_bar@ - @context;noquote@ + @context@ - +

- + Index: openacs-4/packages/bug-tracker/lib/nav-bar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/lib/nav-bar.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/lib/nav-bar.adp 11 Sep 2002 14:03:20 -0000 1.2 +++ openacs-4/packages/bug-tracker/lib/nav-bar.adp 28 Aug 2003 09:45:29 -0000 1.3 @@ -17,7 +17,7 @@ @links.name@ |  - Index: openacs-4/packages/bug-tracker/lib/nav-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/lib/nav-bar.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/bug-tracker/lib/nav-bar.tcl 5 Mar 2003 17:39:52 -0000 1.6 +++ openacs-4/packages/bug-tracker/lib/nav-bar.tcl 28 Aug 2003 09:45:29 -0000 1.7 @@ -14,6 +14,8 @@ set admin_p [permission::permission_p -object_id $package_id -privilege admin] set create_p [expr { [ad_conn user_id] == 0 || [permission::permission_p -object_id [ad_conn package_id] -privilege create] }] +bug_tracker::get_pretty_names -array pretty_names + set notification_url [lindex $notification_link 0] set notification_label [lindex $notification_link 1] set notification_title [lindex $notification_link 2] Index: openacs-4/packages/bug-tracker/lib/version-bar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/lib/version-bar.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/lib/version-bar.adp 5 Mar 2003 17:39:52 -0000 1.2 +++ openacs-4/packages/bug-tracker/lib/version-bar.adp 28 Aug 2003 09:45:29 -0000 1.3 @@ -1,29 +1,20 @@ - - - - - - - - - -
- @user_first_names@ @user_last_name@ - Not logged in (log in) -
- - - Your version: @user_version_name@ - - | Current: @current_version_name@ - - - (current) - - - - Current version: @current_version_name@ - - -
+ +

+ + Your version: @user_version_name@ + + | Current: @current_version_name@ + + + (current) + + + + + Current version: @current_version_name@ + + +
+ + Index: openacs-4/packages/bug-tracker/lib/version-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/lib/version-bar.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/bug-tracker/lib/version-bar.tcl 5 Mar 2003 17:39:52 -0000 1.4 +++ openacs-4/packages/bug-tracker/lib/version-bar.tcl 28 Aug 2003 09:45:29 -0000 1.5 @@ -1,5 +1,12 @@ # Version bar, to be included on all pages +# Is this project using multiple versions? +set versions_p [bug_tracker::versions_p] + +if { !$versions_p } { + return +} + # Project info set current_version_id [bug_tracker::conn current_version_id] @@ -14,12 +21,7 @@ set user_version_id [bug_tracker::conn user_version_id] set user_version_name [bug_tracker::conn user_version_name] -set user_first_names [bug_tracker::conn user_first_names] -set user_last_name [bug_tracker::conn user_last_name] -# Is this project using multiple versions? -set versions_p [bug_tracker::versions_p] - set package_url [ad_conn package_url] set user_version_url "[ad_conn package_url]prefs?[export_vars -url { return_url }]" Index: openacs-4/packages/bug-tracker/sql/oracle/bug-tracker-create-packages.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/oracle/bug-tracker-create-packages.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/sql/oracle/bug-tracker-create-packages.sql 14 Apr 2003 13:34:03 -0000 1.2 +++ openacs-4/packages/bug-tracker/sql/oracle/bug-tracker-create-packages.sql 28 Aug 2003 09:45:29 -0000 1.3 @@ -56,6 +56,10 @@ bug_id in integer ); + function name ( + bug_id in integer + ) return varchar2; + end bt_bug; / show errors @@ -148,9 +152,15 @@ name => 'bug_tracker_' || bt_project.new.package_id, label => v_instance_name, description => null, - parent_id => v_root_folder_id + parent_id => v_root_folder_id, + context_id => bt_project.new.package_id, + creation_user => v_creation_user, + creation_ip => v_creation_ip ); + -- Set package_id column. Oddly enoguh, there is no API to set it + update cr_folders set package_id = bt_project.new.package_id where folder_id = v_folder_id; + -- register our content type content_folder.register_content_type ( folder_id => v_folder_id, @@ -212,6 +222,9 @@ bt_patch.delete(rec.patch_id); end loop; + -- delete the content folder + content_folder.delete(v_folder_id); + -- delete the projects keywords bt_project.keywords_delete( project_id => project_id, @@ -224,10 +237,6 @@ delete from bt_user_prefs where project_id = bt_project.delete.project_id; delete from bt_projects where project_id = bt_project.delete.project_id; - - -- delete the content folder - content_folder.delete(v_folder_id); - end delete; procedure keywords_delete ( @@ -415,7 +424,7 @@ from workflow_cases where object_id = bt_bug.delete.bug_id; - foo := workflow_case.delete(v_case_id); + foo := workflow_case_pkg.delete(v_case_id); -- Every bug may have notifications attached to it -- and there is one column in the notificaitons datamodel that doesn't @@ -430,6 +439,20 @@ return; end delete; + function name ( + bug_id in integer + ) return varchar2 + is + v_name bt_bugs.summary%TYPE; + begin + select summary + into v_name + from bt_bugs + where bug_id = name.bug_id; + + return v_name; + end name; + end bt_bug; / show errors Index: openacs-4/packages/bug-tracker/sql/oracle/upgrade-1.2d10-1.2d11.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/oracle/upgrade-1.2d10-1.2d11.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/sql/oracle/upgrade-1.2d10-1.2d11.sql 28 Aug 2003 09:45:29 -0000 1.2 @@ -0,0 +1,217 @@ +-- Folders had wrong context_id and no package_id set. +-- +-- @author Lars Pind (lars@collaboraid.biz) +-- +-- $Id: upgrade-1.2d10-1.2d11.sql,v 1.2 2003/08/28 09:45:29 lars Exp $ + + +-- recreate the bt_project package + +create or replace package bt_project +as + procedure new ( + package_id in integer + ); + procedure delete ( + project_id in integer + ); + procedure keywords_delete ( + project_id in integer, + delete_root_p in varchar2 default 'f' + ); + +end bt_project; +/ +show errors + +create or replace package body bt_project +as + procedure new ( + package_id in integer + ) + is + v_count integer; + v_instance_name varchar(300); + v_creation_user integer; + v_creation_ip varchar(50); + v_folder_id integer; + v_root_folder_id integer; + v_keyword_id integer; + begin + select count (*) + into v_count + from bt_projects + where project_id = new.package_id; + + if v_count > 0 then + return; + end if; + + -- get instance name for the content folder + select p.instance_name, o.creation_user, o.creation_ip + into v_instance_name, v_creation_user, v_creation_ip + from apm_packages p, + acs_objects o + where p.package_id = bt_project.new.package_id + and p.package_id = o.object_id; + + select content_item.get_root_folder + into v_root_folder_id + from dual; + + -- create a root CR folder + v_folder_id := content_folder.new( + name => 'bug_tracker_' || bt_project.new.package_id, + label => v_instance_name, + description => null, + parent_id => v_root_folder_id, + context_id => bt_project.new.package_id, + creation_user => v_creation_user, + creation_ip => v_creation_ip + ); + + -- Set package_id column. Oddly enoguh, there is no API to set it + update cr_folders set package_id = bt_project.new.package_id where folder_id = v_folder_id; + + -- register our content type + content_folder.register_content_type ( + folder_id => v_folder_id, + content_type => 'bt_bug_revision', + include_subtypes => 't' + ); + + -- create the instance root keyword + v_keyword_id := content_keyword.new( + heading => v_instance_name, + description => null, + parent_id => null, + keyword_id => null, + creation_date => sysdate(), + creation_user => v_creation_user, + creation_ip => v_creation_ip, + object_type => 'content_keyword' + ); + + -- insert the row into bt_projects + insert into bt_projects + (project_id, folder_id, root_keyword_id) + values + (bt_project.new.package_id, v_folder_id, v_keyword_id); + + -- Create a General component to start with + insert into bt_components + (component_id, project_id, component_name) + values + (acs_object_id_seq.nextval, bt_project.new.package_id, 'General'); + + return; + end new; + + procedure delete ( + project_id in integer + ) + is + v_folder_id integer; + v_root_keyword_id integer; + begin + + -- get the content folder for this instance + select folder_id, root_keyword_id + into v_folder_id, v_root_keyword_id + from bt_projects + where project_id = bt_project.delete.project_id; + + -- This get''s done in tcl before we are called ... for now + -- Delete the bugs + -- for rec in select item_id from cr_items where parent_id = v_folder_id + -- loop + -- bt_bug.delete(rec.item_id); + -- end loop; + + -- Delete the patches + for rec in (select patch_id from bt_patches where project_id = bt_project.delete.project_id) + loop + bt_patch.delete(rec.patch_id); + end loop; + + -- delete the content folder + content_folder.delete(v_folder_id); + + -- delete the projects keywords + bt_project.keywords_delete( + project_id => project_id, + delete_root_p => 't' + ); + + -- These tables should really be set up to cascade + delete from bt_versions where project_id = bt_project.delete.project_id; + delete from bt_components where project_id = bt_project.delete.project_id; + delete from bt_user_prefs where project_id = bt_project.delete.project_id; + + delete from bt_projects where project_id = bt_project.delete.project_id; + end delete; + + procedure keywords_delete ( + project_id in integer, + delete_root_p in varchar2 default 'f' + ) + is + v_root_keyword_id integer; + v_changed_p char(1); + begin + -- get the content folder for this instance + select root_keyword_id + into v_root_keyword_id + from bt_projects + where project_id = keywords_delete.project_id; + + -- if we are deleting the root, remove it from the project as well + if delete_root_p = 't' then + update bt_projects + set root_keyword_id = null + where project_id = keywords_delete.project_id; + end if; + + -- delete the projects keywords + + -- Keep looping over all project keywords, deleting all + -- leaf nodes, until everything has been deleted + loop + v_changed_p := 'f'; + for rec in + (select keyword_id + from (select keyword_id + from cr_keywords + start with keyword_id = v_root_keyword_id + connect by prior keyword_id = parent_id) q + where content_keyword.is_leaf(keyword_id) = 't') + loop + if (delete_root_p = 't') or (rec.keyword_id != v_root_keyword_id) then + content_keyword.delete(rec.keyword_id); + v_changed_p := 't'; + end if; + end loop; + + exit when v_changed_p = 'f'; + end loop; + + end keywords_delete; + +end bt_project; +/ +show errors + + + + +-- update context_id, package_id of existing folders + +begin + for rec in (select project_id, folder_id from bt_projects) loop + update acs_objects set context_id = rec.project_id where object_id = rec.folder_id; + update cr_folders set package_id = rec.project_id where folder_id = rec.folder_id; + end loop; + commit; +end; +/ +show errors Index: openacs-4/packages/bug-tracker/sql/oracle/upgrade/upgrade-1.2d8-1.2d9.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/oracle/upgrade/upgrade-1.2d8-1.2d9.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/sql/oracle/upgrade/upgrade-1.2d8-1.2d9.sql 28 Aug 2003 09:45:29 -0000 1.2 @@ -0,0 +1,17 @@ +-- Correcting the CR folders so they inherit permissions from the package +-- +-- @author Lars Pind (lars@collaboraid.biz) + +declare + cursor project_cur is + select project_id, folder_id from bt_projects; +begin + for project_rec in project_cur + loop + update acs_objects + set context_id = project_rec.project_id + where object_id = project_rec.folder_id; + end loop; +end; +/ +show errors Index: openacs-4/packages/bug-tracker/sql/oracle/upgrade/upgrade-1.2d9-1.2d10.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/oracle/upgrade/upgrade-1.2d9-1.2d10.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/sql/oracle/upgrade/upgrade-1.2d9-1.2d10.sql 28 Aug 2003 09:45:29 -0000 1.2 @@ -0,0 +1,34 @@ +-- Implement workflow_case -> workflow_case_pkg change. +-- +-- @author Janine Sisk (janine@furfly.net) +-- +-- This is free software distributed under the terms of the GNU Public +-- License. Full text of the license is available from the GNU Project: +-- http://www.fsf.org/copyleft/gpl.html + +create or replace package bt_bug +as + function new ( + bug_id in integer default null, + bug_number in integer default null, + package_id in integer, + component_id in integer, + found_in_version in integer, + summary in varchar2, + user_agent in varchar2 default '', + comment_content in varchar2, + comment_format in varchar2, + creation_date in date default sysdate(), + creation_user in integer, + creation_ip in varchar2 default null, + item_subtype in varchar2 default 'bt_bug', + content_type in varchar2 default 'bt_bug_revision' + ) return integer; + + procedure delete ( + bug_id in integer + ); + +end bt_bug; +/ +show errors Index: openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-create.sql,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-create.sql 14 Apr 2003 13:34:44 -0000 1.8 +++ openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-create.sql 28 Aug 2003 09:45:29 -0000 1.9 @@ -56,9 +56,18 @@ ''bug_tracker_''||p_package_id, -- name v_instance_name, -- label null, -- description - content_item_globals.c_root_folder_id -- parent_bi + content_item_globals.c_root_folder_id, -- parent_id + p_package_id, -- context_id + null, -- folder_id + now(), -- creation_date + v_creation_user, -- creation_user + v_creation_ip, -- creation_ip, + ''t'' -- security_inherit_p ); + -- Set package_id column. Oddly enoguh, there is no API to set it + update cr_folders set package_id = p_package_id where folder_id = v_folder_id; + -- register our content type PERFORM content_folder__register_content_type ( v_folder_id, -- folder_id @@ -122,8 +131,12 @@ perform bt_patch__delete(rec.patch_id); end loop; + -- delete the content folder + raise notice ''about to delete content_folder.''; + perform content_folder__delete(v_folder_id); + -- delete the projects keywords - perform bt_projects__keywords_delete(p_project_id, ''t''); + perform bt_project__keywords_delete(p_project_id, ''t''); -- These tables should really be set up to cascade delete from bt_versions where project_id = p_project_id; @@ -132,10 +145,6 @@ delete from bt_projects where project_id = p_project_id; - -- delete the content folder - raise notice ''about to delete content_folder.''; - perform content_folder__delete(v_folder_id); - return 0; end; ' language 'plpgsql'; @@ -305,7 +314,7 @@ fix_for_version integer, fixed_in_version integer, -- denormalized from acs_objects - creation_date timestamp, + creation_date timestamptz, creation_user integer, -- constraint constraint bt_bug_parent_id_bug_number_un @@ -391,7 +400,7 @@ varchar, -- user_agent text, -- comment_content varchar, -- comment_format - timestamp, -- creation_date + timestamptz, -- creation_date integer, -- creation_user varchar, -- creation_ip varchar, -- item_subtype @@ -437,7 +446,7 @@ -- create the content item v_bug_id := content_item__new( - v_bug_number, -- name + v_bug_number::varchar, -- name v_folder_id, -- parent_id p_bug_id, -- item_id null, -- locale @@ -496,7 +505,7 @@ from workflow_cases where object_id = p_bug_id; - perform workflow_case__delete(v_case_id); + perform workflow_case_pkg__delete(v_case_id); -- Every bug may have notifications attached to it -- and there is one column in the notificaitons datamodel that doesn''t @@ -532,7 +541,7 @@ varchar, -- resolution varchar, -- user_agent varchar, -- summary - timestamp, -- creation_date + timestamptz, -- creation_date integer, -- creation_user varchar -- creation_ip ) returns int @@ -557,7 +566,7 @@ v_revision_id := content_revision__new( p_summary, -- title null, -- description - now(), -- publish_date + current_timestamp, -- publish_date null, -- mime_type null, -- nls_language null, -- new_data @@ -659,8 +668,8 @@ actor integer not null constraint bt_patch_actions_actor_fk references users(user_id), - action_date timestamp not null - default now(), + action_date timestamptz not null + default current_timestamp, comment_text text, comment_format varchar(30) default 'plain' not null constraint bt_patch_actions_comment_format_ck @@ -715,7 +724,7 @@ v_patch_id := acs_object__new( p_patch_id, -- object_id ''bt_patch'', -- object_type - now(), -- creation_date + current_timestamp, -- creation_date p_creation_user, -- creation_user p_creation_ip, -- creation_ip p_project_id, -- context_id @@ -802,3 +811,4 @@ create index bt_patch_bug_map_patch_id_idx on bt_patch_bug_map(patch_id); create index bt_patch_bug_map_bug_id_idx on bt_patch_bug_map(bug_id); + Index: openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-drop.sql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-drop.sql 5 Mar 2003 17:40:28 -0000 1.5 +++ openacs-4/packages/bug-tracker/sql/postgresql/bug-tracker-drop.sql 28 Aug 2003 09:45:29 -0000 1.6 @@ -56,5 +56,9 @@ drop function bt_patch__new(integer,integer,integer,text,text,text,text,integer,integer,varchar); drop table bt_patch_actions; drop table bt_patches; +drop sequence t_bt_patch_number_seq; +drop view bt_patch_number_seq; +delete from acs_objects where object_type = 'bt_patch'; + select acs_object_type__drop_type('bt_patch', 't'); Index: openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.7d3-0.7d4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.7d3-0.7d4.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.7d3-0.7d4.sql 29 Aug 2002 17:13:06 -0000 1.2 +++ openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.7d3-0.7d4.sql 28 Aug 2003 09:45:29 -0000 1.3 @@ -101,8 +101,8 @@ actor integer not null constraint bt_bug_actions_actor_fk references users(user_id), - action_date timestamp not null - default now(), + action_date timestamptz not null + default current_timestamp, comment text, comment_format varchar(30) default 'plain' not null constraint bt_bug_actions_comment_format_ck Index: openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.7d5-0.8.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.7d5-0.8.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.7d5-0.8.sql 5 Mar 2003 17:40:28 -0000 1.2 +++ openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.7d5-0.8.sql 28 Aug 2003 09:45:29 -0000 1.3 @@ -52,8 +52,8 @@ actor integer not null constraint bt_patch_actions_actor_fk references users(user_id), - action_date timestamp not null - default now(), + action_date timestamptz not null + default current_timestamp, comment text, comment_format varchar(30) default 'plain' not null constraint bt_patch_actions_comment_format_ck Index: openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.9d1-1.2d2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.9d1-1.2d2.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.9d1-1.2d2.sql 5 Mar 2003 17:40:28 -0000 1.1 +++ openacs-4/packages/bug-tracker/sql/postgresql/upgrade-0.9d1-1.2d2.sql 28 Aug 2003 09:45:29 -0000 1.2 @@ -384,11 +384,12 @@ from bt_projects where project_id = p_project_id; - -- Delete the bugs - for rec in select item_id from cr_items where parent_id = v_folder_id - loop - perform bt_bug__delete(rec.item_id); - end loop; + -- This gets done in tcl before we are called ... for now + -- Delete the bugs + -- for rec in select item_id from cr_items where parent_id = v_folder_id + -- loop + -- perform bt_bug__delete(rec.item_id); + -- end loop; -- Delete the patches for rec in select patch_id from bt_patches where project_id = p_project_id @@ -401,7 +402,7 @@ perform content_folder__delete(v_folder_id); -- delete the projects keywords - perform bt_projects__keywords_delete(p_project_id, ''t''); + perform bt_project__keywords_delete(p_project_id, ''t''); -- These tables should really be set up to cascade delete from bt_versions where project_id = p_project_id; @@ -1476,6 +1477,7 @@ -- ******* Drop temporary upgrade tables drop table code_keyword_map_temp; +drop table bug_type_keyword_map_temp; drop table bt_bugs_temp; drop table project_temp; Index: openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d10-1.2d11.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d10-1.2d11.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d10-1.2d11.sql 28 Aug 2003 09:45:29 -0000 1.2 @@ -0,0 +1,114 @@ +-- We were missing an upgrade script to fix the cr_folder permissions inheritance problem. +-- +-- @author Lars Pind (lars@collaboraid.biz) +-- +-- $Id: upgrade-1.2d10-1.2d11.sql,v 1.2 2003/08/28 09:45:29 lars Exp $ + + + +-- recreate this function + +create or replace function bt_project__new( + integer -- package_id +) returns integer +as ' +declare + p_package_id alias for $1; + v_count integer; + v_instance_name varchar; + v_creation_user integer; + v_creation_ip varchar; + v_folder_id integer; + v_keyword_id integer; +begin + select count(*) + into v_count + from bt_projects + where project_id = p_package_id; + + if v_count > 0 then + return 0; + end if; + + -- get instance name for the content folder + select p.instance_name, o.creation_user, o.creation_ip + into v_instance_name, v_creation_user, v_creation_ip + from apm_packages p join acs_objects o on (p.package_id = o.object_id) + where p.package_id = p_package_id; + + -- create a root CR folder + v_folder_id := content_folder__new( + ''bug_tracker_''||p_package_id, -- name + v_instance_name, -- label + null, -- description + content_item_globals.c_root_folder_id, -- parent_id + p_package_id, -- context_id + null, -- folder_id + now(), -- creation_date + v_creation_user, -- creation_user + v_creation_ip, -- creation_ip, + ''t'' -- security_inherit_p + ); + + -- Set package_id column. Oddly enoguh, there is no API to set it + update cr_folders set package_id = p_package_id where folder_id = v_folder_id; + + -- register our content type + PERFORM content_folder__register_content_type ( + v_folder_id, -- folder_id + ''bt_bug_revision'', -- content_type + ''t'' -- include_subtypes + ); + + -- create the instance root keyword + v_keyword_id := content_keyword__new( + v_instance_name, -- heading + null, -- description + null, -- parent_id + null, -- keyword_id + current_timestamp, -- creation_date + v_creation_user, -- creation_user + v_creation_ip, -- creation_ip + ''content_keyword'' -- object_type + ); + + -- insert the row into bt_projects + insert into bt_projects + (project_id, folder_id, root_keyword_id) + values + (p_package_id, v_folder_id, v_keyword_id); + + -- Create a General component to start with + insert into bt_components (component_id, project_id, component_name) + select acs_object_id_seq.nextval, p_package_id, ''General''; + + return 0; +end; +' language 'plpgsql'; + + + +-- update context_id, package_id of existing folders + +create or replace function inline_0( +) returns integer +as ' +declare + rec record; +begin + -- change context_id of bug-tracker root folders to be package instance + + for rec in + select project_id, folder_id from bt_projects + loop + update acs_objects set context_id = rec.project_id where object_id = rec.folder_id; + update cr_folders set package_id = rec.project_id where folder_id = rec.folder_id; + end loop; + + return 0; +end; +' language 'plpgsql'; + +select inline_0 (); + +drop function inline_0 (); Index: openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d5-1.2d6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d5-1.2d6.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d5-1.2d6.sql 28 Aug 2003 09:45:29 -0000 1.2 @@ -0,0 +1,73 @@ +-- The bt_project__delete proc had a misspelled call to bt_project__keyword_delete. +-- The upgrade-0.9d1-1.2d2.sql upgrade script forgot to delete a temporary table +-- +-- @author Lars Pind +-- @creation-date 2003-03-11 + +create or replace function bt_project__delete( + integer -- project_id +) returns integer +as ' +declare + p_project_id alias for $1; + v_folder_id integer; + v_root_keyword_id integer; + rec record; +begin + -- get the content folder for this instance + select folder_id, root_keyword_id + into v_folder_id, v_root_keyword_id + from bt_projects + where project_id = p_project_id; + + -- This gets done in tcl before we are called ... for now + -- Delete the bugs + -- for rec in select item_id from cr_items where parent_id = v_folder_id + -- loop + -- perform bt_bug__delete(rec.item_id); + -- end loop; + + -- Delete the patches + for rec in select patch_id from bt_patches where project_id = p_project_id + loop + perform bt_patch__delete(rec.patch_id); + end loop; + + -- delete the content folder + raise notice ''about to delete content_folder.''; + perform content_folder__delete(v_folder_id); + + -- delete the projects keywords + perform bt_project__keywords_delete(p_project_id, ''t''); + + -- These tables should really be set up to cascade + delete from bt_versions where project_id = p_project_id; + delete from bt_components where project_id = p_project_id; + delete from bt_user_prefs where project_id = p_project_id; + + delete from bt_projects where project_id = p_project_id; + + return 0; +end; +' language 'plpgsql'; + + +create or replace function inline_0 () +returns integer as ' +declare + v_count integer; +begin + select count(*) + into v_count + from pg_class + where relname = ''bug_type_keyword_map_temp''; + + if v_count > 0 then + drop table bug_type_keyword_map_temp; + end if; + + return 0; +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + Index: openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d6-1.2d7.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d6-1.2d7.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d6-1.2d7.sql 28 Aug 2003 09:45:29 -0000 1.2 @@ -0,0 +1,103 @@ +-- Correcting the 0.9d-1.2d2 upgrade that left the temporary definition +-- of bt_bug__new +-- +-- @author Peter Marklund + +create or replace function bt_bug__new( + integer, -- bug_id + integer, -- bug_number + integer, -- package_id + integer, -- component_id + integer, -- found_in_version + varchar, -- summary + varchar, -- user_agent + text, -- comment_content + varchar, -- comment_format + timestamptz, -- creation_date + integer, -- creation_user + varchar, -- creation_ip + varchar, -- item_subtype + varchar -- content_type +) returns int +as ' +declare + p_bug_id alias for $1; + p_bug_number alias for $2; + p_package_id alias for $3; + p_component_id alias for $4; + p_found_in_version alias for $5; + p_summary alias for $6; + p_user_agent alias for $7; + p_comment_content alias for $8; + p_comment_format alias for $9; + p_creation_date alias for $10; + p_creation_user alias for $11; + p_creation_ip alias for $12; + p_item_subtype alias for $13; + p_content_type alias for $14; + + v_bug_id integer; + v_revision_id integer; + v_bug_number integer; + v_folder_id integer; +begin + -- get the content folder for this instance + select folder_id + into v_folder_id + from bt_projects + where project_id = p_package_id; + + -- get bug_number + if p_bug_number is null then + select coalesce(max(bug_number),0) + 1 + into v_bug_number + from bt_bugs + where parent_id = v_folder_id; + else + v_bug_number := p_bug_number; + end if; + + -- create the content item + v_bug_id := content_item__new( + v_bug_number, -- name + v_folder_id, -- parent_id + p_bug_id, -- item_id + null, -- locale + p_creation_date, -- creation_date + p_creation_user, -- creation_user + v_folder_id, -- context_id + p_creation_ip, -- creation_ip + p_item_subtype, -- item_subtype + p_content_type, -- content_type + null, -- title + null, -- description + null, -- mime_type + null, -- nls_language + null -- data + ); + + -- create the item type row + insert into bt_bugs + (bug_id, bug_number, comment_content, comment_format, parent_id, project_id, creation_date, creation_user) + values + (v_bug_id, v_bug_number, p_comment_content, p_comment_format, v_folder_id, p_package_id, p_creation_date, p_creation_user); + + -- create the initial revision + v_revision_id := bt_bug_revision__new( + null, -- bug_revision_id + v_bug_id, -- bug_id + p_component_id, -- component_id + p_found_in_version, -- found_in_version + null, -- fix_for_version + null, -- fixed_in_version + null, -- resolution + p_user_agent, -- user_agent + p_summary, -- summary + p_creation_date, -- creation_date + p_creation_user, -- creation_user + p_creation_ip -- creation_ip + ); + + return v_bug_id; +end; +' language 'plpgsql'; Index: openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d8-1.2d9.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d8-1.2d9.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d8-1.2d9.sql 28 Aug 2003 09:45:29 -0000 1.2 @@ -0,0 +1,26 @@ +-- Correcting the CR folders so they inherit permissions from the package +-- +-- @author Lars Pind (lars@collaboraid.biz) + +create or replace function inline_0 () +returns integer as ' +declare + project_rec record; +begin + for project_rec in + select project_id, folder_id + from bt_projects + loop + update acs_objects + set context_id = project_rec.project_id + where object_id = project_rec.folder_id; + end loop; + + return 0; +end;' language 'plpgsql'; + +select inline_0(); + +drop function inline_0(); + + Index: openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d9-1.2d10.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d9-1.2d10.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/sql/postgresql/upgrade-1.2d9-1.2d10.sql 28 Aug 2003 09:45:29 -0000 1.2 @@ -0,0 +1,44 @@ +-- Fixing the implementation of the bt_bug__delete function to work with +-- renamed workflow_case_pkg__delete function. +-- +-- @author Lars Pind (lars@collaboraid.biz) +-- +-- $Id: upgrade-1.2d9-1.2d10.sql,v 1.2 2003/08/28 09:45:29 lars Exp $ + +create or replace function bt_bug__delete( + integer -- bug_id +) returns integer +as ' +declare + p_bug_id alias for $1; + v_case_id integer; + rec record; +begin + -- Every bug is associated with a workflow case + select case_id + into v_case_id + from workflow_cases + where object_id = p_bug_id; + + perform workflow_case_pkg__delete(v_case_id); + + -- Every bug may have notifications attached to it + -- and there is one column in the notificaitons datamodel that doesn''t + -- cascade + for rec in select notification_id from notifications + where response_id = p_bug_id loop + + perform notification__delete (rec.notification_id); + end loop; + + -- unset live & latest revision +-- update cr_items +-- set live_revision = null, +-- latest_revision = null +-- where item_id = p_bug_id; + + perform content_item__delete(p_bug_id); + + return 0; +end; +' language 'plpgsql'; Index: openacs-4/packages/bug-tracker/tcl/bug-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/tcl/bug-procs.tcl 5 Mar 2003 17:40:50 -0000 1.2 +++ openacs-4/packages/bug-tracker/tcl/bug-procs.tcl 28 Aug 2003 09:45:29 -0000 1.3 @@ -42,20 +42,20 @@ upvar $array row db_1row select_bug_data {} -column_array row - + # Get the case ID, so we can get state information set case_id [workflow::case::get_id \ - -object_id $bug_id \ - -workflow_short_name [bug_tracker::bug::workflow_short_name]] - + -object_id $bug_id \ + -workflow_short_name [bug_tracker::bug::workflow_short_name]] + # Derived fields set row(bug_number_display) "#$row(bug_number)" set row(component_name) [bug_tracker::component_get_name -component_id $row(component_id)] set row(found_in_version_name) [bug_tracker::version_get_name -version_id $row(found_in_version)] set row(fix_for_version_name) [bug_tracker::version_get_name -version_id $row(fix_for_version)] set row(fixed_in_version_name) [bug_tracker::version_get_name -version_id $row(fixed_in_version)] - - + + # Get state information workflow::case::fsm::get -case_id $case_id -array case -action_id $action_id set row(pretty_state) $case(pretty_state) @@ -65,7 +65,6 @@ set row(state_short_name) $case(state_short_name) set row(hide_fields) $case(state_hide_fields) set row(entry_id) $case(entry_id) - } ad_proc -public bug_tracker::bug::insert { @@ -129,6 +128,7 @@ {-ip_address ""} {-item_subtype "bt_bug"} {-content_type "bt_bug_revision"} + {-keyword_ids {}} } { Create a new bug, then send out notifications, starts workflow, etc. @@ -155,6 +155,10 @@ -content_type $content_type \ ] + foreach keyword_id $keyword_ids { + cr::keyword::item_assign -item_id $bug_id -keyword_id $keyword_id + } + workflow::case::new \ -workflow_id [workflow::get_id -object_id $package_id -short_name [workflow_short_name]] \ -object_id $bug_id \ @@ -240,7 +244,7 @@ # Update the keywords foreach {category_id category_name} [bug_tracker::category_types] { - if { [info exists row($category_id)] } { + if { [exists_and_not_null row($category_id)] } { cr::keyword::item_assign -singular -item_id $bug_id -keyword_id $row($category_id) } # LARS: @@ -278,7 +282,7 @@ @return 3-tuple of url, label and title. } { set user_id [ad_conn user_id] - set return_url [util_get_current_url] + set return_url [ad_return_url] # Get the type id set type "workflow_case" @@ -299,12 +303,12 @@ -url $return_url \ -user_id $user_id \ -pretty_name "this bug"] - set label "Watch this bug" - set title "Request notifications for all activity on this bug" + set label "Watch this [bug_tracker::conn bug]" + set title "Request notifications for all activity on this [bug_tracker::conn bug]" } else { set url [notification::display::unsubscribe_url -request_id $request_id -url $return_url] - set label "Stop watching this bug" - set title "Unsubscribe to notifications for activity on this bug" + set label "Stop watching this [bug_tracker::conn bug]" + set title "Unsubscribe to notifications for activity on this [bug_tracker::conn bug]" } return [list $url $label $title] } @@ -420,115 +424,6 @@ } } -# set spec { -# bug { -# pretty_name "Bug" -# package_key "bug-tracker" -# object_type "bt_bug" -# callbacks { -# bug-tracker.FormatLogTitle -# bug-tracker.BugNotificationInfo -# } -# roles { -# submitter { -# pretty_name "Submitter" -# callbacks { -# workflow.Role_DefaultAssignees_CreationUser -# } -# } -# assignee { -# pretty_name Assignee -# callbacks { -# bug-tracker.ComponentMaintainer -# bug-tracker.ProjectMaintainer -# workflow.Role_PickList_CurrentAssignees -# workflow.Role_AssigneeSubquery_RegisteredUsers -# } -# } -# } -# states { -# open { -# pretty_name "Open" -# hide_fields { resolution fixed_in_version } -# } -# resolved { -# pretty_name "Resolved" -# } -# closed { -# pretty_name "Closed" -# } -# } -# actions { -# open { -# pretty_name Open -# pretty_past_tense Opened -# new_state "open" -# initial_action_p t -# } -# comment { -# pretty_name Comment -# pretty_past_tense Commented -# allowed_roles { submitter assignee } -# privileges { read write } -# always_enabled_p t -# } -# edit { -# pretty_name Edit -# pretty_past_tense Edited -# allowed_roles { submitter assignee } -# privileges { write } -# always_enabled_p t -# edit_fields { -# component_id -# bug_type -# summary -# severity -# priority -# found_in_version -# role_assignee -# fix_for_version -# resolution -# fixed_in_version -# } -# } -# reassign { -# pretty_name Reassign -# pretty_past_tense Reassigned -# allowed_role { submitter assignee } -# privileges { write } -# enabled_states { open resolved } -# edit_fields { role_assignee } -# } -# resolve { -# pretty_name Resolve -# pretty_past_tense Resolved -# assigned_role "assignee" -# enabled_states { resolved } -# assigned_states { open } -# new_state "resolved" -# privileges { write } -# edit_fields { resolution fixed_in_version } -# callbacks { bug-tracker.CaptureResolutionCode } -# } -# close { -# pretty_name Close -# pretty_past_tense Closed -# assigned_role "submitter" -# assigned_states { resolved } -# new_state "closed" -# privileges { write } -# } -# reopen { -# pretty_name Reopen -# pretty_past_tense Reopened -# allowed_roles { submitter } -# enabled_states { resolved closed } -# new_state "open" -# privileges { write } -# } -# } -# } -# } set workflow_id [workflow::fsm::new_from_spec -spec $spec] return $workflow_id @@ -607,7 +502,10 @@ action_id entry_id } { - db_dml insert_resolution_code {} + workflow::case::add_log_data \ + -entry_id $entry_id \ + -key "resolution" \ + -value [db_string select_resolution_code {}] } ##### Index: openacs-4/packages/bug-tracker/tcl/bug-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/tcl/bug-procs.xql 5 Mar 2003 17:40:50 -0000 1.1 +++ openacs-4/packages/bug-tracker/tcl/bug-procs.xql 28 Aug 2003 09:45:29 -0000 1.2 @@ -22,25 +22,14 @@
- + - insert into workflow_case_log_data - (entry_id, key, value) - select :entry_id, 'resolution', resolution + select resolution from bt_bugs where bug_id = :object_id - - - select value - from workflow_case_log_data - where entry_id = :entry_id - and key = 'resolution' - - - select c.maintainer Index: openacs-4/packages/bug-tracker/tcl/bug-tracker-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-tracker-procs-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/tcl/bug-tracker-procs-oracle.xql 5 Mar 2003 17:40:50 -0000 1.1 +++ openacs-4/packages/bug-tracker/tcl/bug-tracker-procs-oracle.xql 28 Aug 2003 09:45:29 -0000 1.2 @@ -151,7 +151,7 @@ begin - workflow_case.delete(:case_id); + workflow_case_pkg.delete(:case_id); end; Index: openacs-4/packages/bug-tracker/tcl/bug-tracker-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-tracker-procs-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/tcl/bug-tracker-procs-postgresql.xql 5 Mar 2003 17:40:50 -0000 1.1 +++ openacs-4/packages/bug-tracker/tcl/bug-tracker-procs-postgresql.xql 28 Aug 2003 09:45:29 -0000 1.2 @@ -145,7 +145,7 @@ - select workflow_case__delete(:case_id); + select workflow_case_pkg__delete(:case_id); Index: openacs-4/packages/bug-tracker/tcl/bug-tracker-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/tcl/bug-tracker-procs.tcl,v diff -u -N -r1.18 -r1.19 --- openacs-4/packages/bug-tracker/tcl/bug-tracker-procs.tcl 5 Mar 2003 17:40:50 -0000 1.18 +++ openacs-4/packages/bug-tracker/tcl/bug-tracker-procs.tcl 28 Aug 2003 09:45:29 -0000 1.19 @@ -4,7 +4,7 @@ @creation-date 2002-05-03 @author Lars Pind - @cvs-id $Id$ + @cvs-id bug-tracker-procs.tcl,v 1.13.2.7 2003/03/05 18:13:39 lars Exp } @@ -959,7 +959,6 @@ {-comment:required} {-format:required} } { - ns_log Notice "LARS: Format=$format, comment=$comment, formatted = [ad_html_text_convert -from $format -to text/html -- $comment]" return [ad_html_text_convert -from $format -to text/html -- $comment] } @@ -1276,6 +1275,7 @@ {action_id} fix_for_version:integer assignee:integer + enabled_action_assignee:integer action_id:integer component_id:integer keyword:integer,multiple @@ -1382,6 +1382,38 @@ } append human_readable_filter " where [join $keyword_human " and "]" } + + if { [info exists filter_enabled_action_assignee] } { + lappend where_clauses { + exists ( + select 1 + from workflow_cases cas2, + workflow_case_fsm cfsm2, + workflow_actions a2, + workflow_case_role_party_map crpm2 + where cas2.object_id = b.bug_id + and (a2.always_enabled_p = 't' + or exists (select 1 + from workflow_fsm_action_en_in_st aeis + where aeis.state_id = cfsm.current_state + and aeis.action_id = a2.action_id + and aeis.assigned_p = 't' + ) + ) + and cfsm2.case_id = cas2.case_id + and crpm2.case_id = cas2.case_id + and crpm2.role_id = a2.assigned_role + and crpm2.party_id = :filter_enabled_action_assignee + ) + } + if { $filter_enabled_action_assignee == [ad_conn user_id] } { + append human_readable_filter " awaiting action by me" + } else { + array set person [person::get -person_id $filter_enabled_action_assignee] + + append human_readable_filter " awaiting action by $person(first_names) $person(last_name)" + } + } if { ![empty_string_p [conn component_id]] } { set filter_component_id [conn component_id] Index: openacs-4/packages/bug-tracker/www/bug-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/bug-add.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/bug-tracker/www/bug-add.adp 22 May 2003 14:24:00 -0000 1.5 +++ openacs-4/packages/bug-tracker/www/bug-add.adp 28 Aug 2003 09:45:29 -0000 1.6 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context_bar@ bug.component_id @@ -11,6 +11,6 @@
- + Index: openacs-4/packages/bug-tracker/www/bug-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/bug-add.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/bug-tracker/www/bug-add.tcl 5 Mar 2003 17:41:04 -0000 1.9 +++ openacs-4/packages/bug-tracker/www/bug-add.tcl 28 Aug 2003 09:45:29 -0000 1.10 @@ -44,11 +44,10 @@ {label "Summary"} {html {size 50}} } - {found_in_version:text(select) + {found_in_version:text(select),optional {label "Version"} {options {[bug_tracker::version_get_options -include_unknown]}} {value {[bug_tracker::conn user_version_id]}} - optional } {return_url:text(hidden) {value $return_url}} @@ -64,28 +63,30 @@ } ad_form -extend -name bug -form { - {description:richtext(richtext) + {description:richtext(richtext),optional {label "Description"} {html {cols 60 rows 13}} - optional } } ad_form -extend -name bug -new_data { + + set keyword_ids [list] + foreach {category_id category_name} [bug_tracker::category_types] { + # -singular not required here since it's a new bug + lappend keyword_ids [element get_value bug $category_id] + } + bug_tracker::bug::new \ -bug_id $bug_id \ -package_id $package_id \ -component_id $component_id \ -found_in_version $found_in_version \ -summary $summary \ -description [template::util::richtext::get_property contents $description] \ - -desc_format [template::util::richtext::get_property format $description] - - foreach {category_id category_name} [bug_tracker::category_types] { - # -singular not required here since it's a new bug - cr::keyword::item_assign -item_id $bug_id -keyword_id [element get_value bug $category_id] - } + -desc_format [template::util::richtext::get_property format $description] \ + -keyword_ids $keyword_ids } -after_submit { bug_tracker::bugs_exist_p_set_true Index: openacs-4/packages/bug-tracker/www/bug.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/bug.adp,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/bug-tracker/www/bug.adp 22 May 2003 14:24:00 -0000 1.6 +++ openacs-4/packages/bug-tracker/www/bug.adp 28 Aug 2003 09:45:29 -0000 1.7 @@ -1,7 +1,7 @@ -@page_title;noquote@ -@context_bar;noquote@ -@notification_link;noquote@ +@page_title@ +@context_bar@ +@notification_link@ @@ -18,7 +18,7 @@

- +

Index: openacs-4/packages/bug-tracker/www/bug.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/bug.tcl,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/bug-tracker/www/bug.tcl 5 Mar 2003 17:41:04 -0000 1.19 +++ openacs-4/packages/bug-tracker/www/bug.tcl 28 Aug 2003 09:45:29 -0000 1.20 @@ -53,9 +53,7 @@ set workflow_id [bug_tracker::bug::get_instance_workflow_id] -set role_ids [workflow::get_roles -workflow_id $workflow_id] - ##### # # Action @@ -64,12 +62,6 @@ set action_id [form get_action bug] -if { ![empty_string_p $action_id] } { - set action_short_name [workflow::action::get_element -action_id $action_id -element short_name] -} else { - set action_short_name {} -} - # Registration required for all actions if { ![empty_string_p $action_id] } { ad_maybe_redirect_for_registration @@ -104,15 +96,14 @@ set patch_label [ad_decode $show_patch_status "open" "Open Patches (show all)" "all" "All Patches (show only open)" "Patches"] ad_form -name bug -cancel_url $return_url -mode display -has_edit 1 -actions $actions -form { - {bug_number_display:integer(inform) + {bug_number_display:text(inform) {label "[bug_tracker::conn Bug] \#"} {mode display} } - {component_id:integer(select) + {component_id:integer(select),optional {label "[bug_tracker::conn Component]"} {options {[bug_tracker::components_get_options]}} {mode display} - optional } {summary:text(text) {label "Summary"} @@ -131,11 +122,10 @@ {after_html ""} {mode display} } - {resolution:text(select) + {resolution:text(select),optional {label "Resolution"} {options {[bug_tracker::resolution_get_options]}} {mode display} - optional } } @@ -151,11 +141,10 @@ ad_form -extend -name bug -form { - {found_in_version:text(select) + {found_in_version:text(select),optional {label "Found in Version"} {options {[bug_tracker::version_get_options -include_unknown]}} {mode display} - optional } } @@ -171,30 +160,25 @@ {label "User Agent"} {mode display} } - {fix_for_version:text(select) + {fix_for_version:text(select),optional {label "Fix for Version"} {options {[bug_tracker::version_get_options -include_undecided]}} {mode display} - optional } - {fixed_in_version:text(select) + {fixed_in_version:text(select),optional {label "Fixed in Version"} {options {[bug_tracker::version_get_options -include_undecided]}} {mode display} - optional } - {description:richtext(richtext) + {description:richtext(richtext),optional {label "Description"} {html {cols 60 rows 13}} - optional } {return_url:text(hidden) {value $return_url} } {bug_number:key} - {entry_id:integer(hidden) - optional - } + {entry_id:integer(hidden),optional} } # Export filters @@ -211,8 +195,10 @@ foreach field [workflow::action::get_element -action_id $action_id -element edit_fields] { element set_properties bug $field -mode edit } - if {[string compare $action_short_name "edit"] == 0} { - foreach {category_id category_name} [bug_tracker::category_types] { + + # LARS: Hack! How do we set editing of dynamic fields? + if { [string equal [workflow::action::get_element -action_id $action_id -element short_name] "edit"] } { + foreach { category_id category_name } [bug_tracker::category_types] { element set_properties bug $category_id -mode edit } } @@ -253,7 +239,7 @@ # whenever the form is displayed, whether initially or because of a validation error. } -# Not-valid block (request, error) +# Not-valid block (request or submit error) if { ![form is_valid bug] } { # Get the bug data @@ -305,7 +291,6 @@ element set_properties bug user_agent -widget hidden } - # Set regular element values foreach element $element_names { @@ -316,7 +301,7 @@ } } } - + # Add empty option to resolution code if { ![empty_string_p $action_id] } { if { [lsearch [workflow::action::get_element -action_id $action_id -element edit_fields] "resolution"] == -1 } { @@ -341,17 +326,17 @@ # Set values for description field element set_properties bug description \ - -before_html "[workflow::case::get_activity_html -case_id $case_id][ad_decode $action_id "" "" "

$bug(now_pretty) [bug_tracker::bug_action_pretty $action_short_name] by [bug_tracker::conn user_first_names] [bug_tracker::conn user_last_name]

"]" + -before_html [workflow::case::get_activity_html -case_id $case_id -action_id $action_id] # Set page title set page_title "[bug_tracker::conn Bug] #$bug_number: $bug(summary)" # Context bar if { [info exists filter] } { - if { [array names filter] == [list "actionby"] && $filter(actionby) == $user_id } { - set context_bar [bug_tracker::context_bar [list ".?[export_vars { filter:array }]" "My bugs"] $page_title] + if { [array names filter] == [list "assignee"] && $filter(assignee) == $user_id } { + set context_bar [bug_tracker::context_bar [list ".?[export_vars { filter:array }]" "My [bug_tracker::conn bugs]"] $page_title] } else { - set context_bar [bug_tracker::context_bar [list ".?[export_vars { filter:array }]" "Filtered bug list"] $page_title] + set context_bar [bug_tracker::context_bar [list ".?[export_vars { filter:array }]" "Filtered [bug_tracker::conn bug] list"] $page_title] } } else { set context_bar [bug_tracker::context_bar $page_title] @@ -413,4 +398,3 @@ } ad_return_template - Index: openacs-4/packages/bug-tracker/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/Attic/index-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/index-oracle.xql 5 Mar 2003 17:41:04 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/index-oracle.xql 28 Aug 2003 09:45:29 -0000 1.2 @@ -117,7 +117,8 @@ workflow_actions a, workflow_case_role_party_map crpm, parties p - where cas.object_id = b.bug_id + where b.project_id = :package_id + and cas.object_id = b.bug_id and (a.always_enabled_p = 't' or exists (select 1 from workflow_fsm_action_en_in_st aeis Index: openacs-4/packages/bug-tracker/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/Attic/index-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/index-postgresql.xql 5 Mar 2003 17:41:04 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/index-postgresql.xql 28 Aug 2003 09:45:29 -0000 1.2 @@ -111,7 +111,8 @@ workflow_actions a, workflow_case_role_party_map crpm, parties p - where cas.object_id = b.bug_id + where b.project_id = :package_id + and cas.object_id = b.bug_id and (a.always_enabled_p = 't' or exists (select 1 from workflow_fsm_action_en_in_st aeis Index: openacs-4/packages/bug-tracker/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/index.adp,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/bug-tracker/www/index.adp 22 May 2003 14:24:00 -0000 1.6 +++ openacs-4/packages/bug-tracker/www/index.adp 28 Aug 2003 09:45:29 -0000 1.7 @@ -1,6 +1,6 @@ -@project_name;noquote@ -@context_bar;noquote@ +@project_name@ +@context_bar@
@@ -53,7 +53,7 @@
-
+
Order by:
Index: openacs-4/packages/bug-tracker/www/notifications.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/notifications.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/notifications.tcl 5 Mar 2003 17:41:04 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/notifications.tcl 28 Aug 2003 09:45:29 -0000 1.2 @@ -21,7 +21,7 @@ } set user_id [ad_conn user_id] -set return_url [util_get_current_url] +set return_url [ad_return_url] multirow create notifications url label title subscribed_p Index: openacs-4/packages/bug-tracker/www/patch-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/patch-add.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/bug-tracker/www/patch-add.adp 22 May 2003 14:24:00 -0000 1.4 +++ openacs-4/packages/bug-tracker/www/patch-add.adp 28 Aug 2003 09:45:29 -0000 1.5 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context@ patch.summary
@@ -11,4 +11,4 @@
- + Index: openacs-4/packages/bug-tracker/www/patch-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/patch-add.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/bug-tracker/www/patch-add.tcl 5 Mar 2003 17:41:04 -0000 1.7 +++ openacs-4/packages/bug-tracker/www/patch-add.tcl 28 Aug 2003 09:45:29 -0000 1.8 @@ -31,7 +31,7 @@ set package_id [ad_conn package_id] set package_key [ad_conn package_key] set page_title "New Patch" -set context_bar [ad_context_bar $page_title] +set context [list $page_title] set user_id [ad_conn user_id] # Is this project using multiple versions? Index: openacs-4/packages/bug-tracker/www/patch-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/patch-list.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/bug-tracker/www/patch-list.adp 22 May 2003 14:24:00 -0000 1.4 +++ openacs-4/packages/bug-tracker/www/patch-list.adp 28 Aug 2003 09:45:29 -0000 1.5 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context@

Component: [ Index: openacs-4/packages/bug-tracker/www/patch-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/patch-list.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/bug-tracker/www/patch-list.tcl 16 Jan 2003 13:43:58 -0000 1.3 +++ openacs-4/packages/bug-tracker/www/patch-list.tcl 28 Aug 2003 09:45:29 -0000 1.4 @@ -15,7 +15,7 @@ set user_id [ad_conn user_id] set page_title "Patches" -set context_bar [ad_context_bar $page_title] +set context [list $page_title] # Create the component filter set component_filter_list [list] Index: openacs-4/packages/bug-tracker/www/patch.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/patch.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/bug-tracker/www/patch.adp 22 May 2003 14:24:00 -0000 1.3 +++ openacs-4/packages/bug-tracker/www/patch.adp 28 Aug 2003 09:45:29 -0000 1.4 @@ -1,8 +1,8 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context@ - +

@@ -17,8 +17,7 @@

- - +

Download patch content Index: openacs-4/packages/bug-tracker/www/patch.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/patch.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/patch.tcl 5 Mar 2003 17:41:04 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/patch.tcl 28 Aug 2003 09:45:29 -0000 1.3 @@ -154,7 +154,7 @@ -label "Patch #" element create patch component_id \ - -datatype integer \ + -datatype text \ -widget [ad_decode [info exists field_editable_p(component_id)] 1 select inform] \ -label "Component" \ -options [bug_tracker::components_get_options] @@ -255,7 +255,7 @@ -value $mode set page_title "Patch #$patch_number" -set context_bar [ad_context_bar $page_title] +set context [list $page_title] if { [form is_request patch] } { # The form was requested @@ -311,6 +311,8 @@ element set_properties patch applied_to_version \ -value [ad_decode [info exists field_editable_p(applied_to_version)] 1 $patch(applied_to_version) $patch(applied_to_version_name)] + set deleted_p [string equal $patch(status) deleted] + if { ( [string equal $patch(status) open] && ![string equal $mode "accept"]) || [string equal $patch(status) "refused"] } { element set_properties patch applied_to_version -widget hidden } Index: openacs-4/packages/bug-tracker/www/prefs.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/prefs.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/bug-tracker/www/prefs.adp 22 May 2003 14:24:00 -0000 1.3 +++ openacs-4/packages/bug-tracker/www/prefs.adp 28 Aug 2003 09:45:29 -0000 1.4 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context@ prefs.user_version - + Index: openacs-4/packages/bug-tracker/www/prefs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/prefs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/bug-tracker/www/prefs.tcl 5 Mar 2003 17:41:04 -0000 1.8 +++ openacs-4/packages/bug-tracker/www/prefs.tcl 28 Aug 2003 09:45:29 -0000 1.9 @@ -21,24 +21,25 @@ set page_title "Your Preferences" -set context_bar [ad_context_bar $page_title] +set context [list $page_title] set user_id [ad_conn user_id] ad_form -name prefs -cancel_url $return_url -form { - {user_version:integer(select) + {user_version:integer(select),optional {label "Your version"} {options {[bug_tracker::version_get_options -include_unknown]}} - optional } {return_url:text(hidden) {value $return_url} } -} -select_query { - select user_version - from prefs - where user_id = :user_id - and project_id = :package_id +} -on_request { + db_0or1row select_data { + select user_version + from bt_user_prefs + where user_id = :user_id + and project_id = :package_id + } } -after_submit { set user_version [element get_value prefs user_version] db_dml update_row { Index: openacs-4/packages/bug-tracker/www/admin/categories.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/categories.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/categories.adp 22 May 2003 14:24:26 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/categories.adp 28 Aug 2003 09:45:30 -0000 1.3 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context_bar@

Index: openacs-4/packages/bug-tracker/www/admin/category-defaults.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/category-defaults.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/category-defaults.adp 22 May 2003 14:24:26 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/category-defaults.adp 28 Aug 2003 09:45:30 -0000 1.3 @@ -1,5 +1,5 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context_bar@ Index: openacs-4/packages/bug-tracker/www/admin/category-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/category-delete.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/admin/category-delete.tcl 5 Mar 2003 17:41:17 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/admin/category-delete.tcl 28 Aug 2003 09:45:30 -0000 1.2 @@ -4,6 +4,9 @@ keyword_id:integer } -db_exec_plsql delete_keyword { } +cr::keyword::delete \ + -keyword_id $keyword_id +bug_tracker::get_keywords_flush + ad_returnredirect categories Index: openacs-4/packages/bug-tracker/www/admin/category-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/category-edit.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/category-edit.adp 22 May 2003 14:24:26 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/category-edit.adp 28 Aug 2003 09:45:30 -0000 1.3 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context_bar@ keyword.heading Index: openacs-4/packages/bug-tracker/www/admin/component-ae-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/Attic/component-ae-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/www/admin/component-ae-oracle.xql 28 Aug 2003 09:45:30 -0000 1.2 @@ -0,0 +1,18 @@ + + + + oracle8.1.6 + + + + select distinct u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as name, u.user_id + from cc_users u + where upper(nvl(u.first_names || ' ', '') || + nvl(u.last_name || ' ', '') || + u.email || ' ' || + nvl(u.screen_name, '')) like upper('%'||:value||'%') + order by name + + + + Index: openacs-4/packages/bug-tracker/www/admin/component-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/Attic/component-ae-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bug-tracker/www/admin/component-ae-postgresql.xql 28 Aug 2003 09:45:30 -0000 1.2 @@ -0,0 +1,18 @@ + + + + postgresql7.1 + + + + select distinct u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as name, u.user_id + from cc_users u + where upper(coalesce(u.first_names || ' ', '') || + coalesce(u.last_name || ' ', '') || + u.email || ' ' || + coalesce(u.screen_name, '')) like upper('%'||:value||'%') + order by name + + + + Index: openacs-4/packages/bug-tracker/www/admin/component-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/component-ae.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/bug-tracker/www/admin/component-ae.adp 22 May 2003 14:24:26 -0000 1.3 +++ openacs-4/packages/bug-tracker/www/admin/component-ae.adp 28 Aug 2003 09:45:30 -0000 1.4 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context;noquote@ +@page_title@ +@context@ component.name Index: openacs-4/packages/bug-tracker/www/admin/component-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/component-ae.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/bug-tracker/www/admin/component-ae.tcl 5 Mar 2003 17:41:17 -0000 1.8 +++ openacs-4/packages/bug-tracker/www/admin/component-ae.tcl 28 Aug 2003 09:45:30 -0000 1.9 @@ -23,23 +23,15 @@ {component_id:key(acs_object_id_seq)} {return_url:text(hidden) {value $return_url}} {name:text {html { size 50 }} {label "[bug_tracker::conn Component] Name"}} - {description:text(hidden) {label {Description}} optional {html { cols 50 rows 8 }}} - {url_name:text {html { size 50 }} {label {Name in shortcut URL}} optional + {description:text(hidden),optional {label {Description}} {html { cols 50 rows 8 }}} + {url_name:text,optional {html { size 50 }} {label {Name in shortcut URL}} {help_text "You can filter by this [bug_tracker::conn component] by viisting [ad_conn package_url]com/this-name/"} } - {maintainer:search + {maintainer:search,optional {result_datatype integer} {label "Maintainer"} {options [bug_tracker::users_get_options]} - optional - {search_query - { - select distinct u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as name, u.user_id - from cc_users u - where upper(coalesce(u.first_names || ' ', '') || coalesce(u.last_name || ' ', '') || u.email || ' ' || coalesce(u.screen_name, '')) like upper('%'||:value||'%') - order by name - } - } + {search_query {[db_map user_search]}} } } -select_query { select component_id, Index: openacs-4/packages/bug-tracker/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/index.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/bug-tracker/www/admin/index.adp 22 May 2003 14:24:26 -0000 1.4 +++ openacs-4/packages/bug-tracker/www/admin/index.adp 28 Aug 2003 09:45:30 -0000 1.5 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context_bar@
Index: openacs-4/packages/bug-tracker/www/admin/initial-setup.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/initial-setup.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/initial-setup.adp 22 May 2003 14:24:26 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/initial-setup.adp 28 Aug 2003 09:45:30 -0000 1.3 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context_bar@

Choose your project's initial configuration. Index: openacs-4/packages/bug-tracker/www/admin/project-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/project-edit.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/bug-tracker/www/admin/project-edit.adp 22 May 2003 14:24:26 -0000 1.3 +++ openacs-4/packages/bug-tracker/www/admin/project-edit.adp 28 Aug 2003 09:45:30 -0000 1.4 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context;noquote@ +@page_title@ +@context@ project.name Index: openacs-4/packages/bug-tracker/www/admin/project-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/project-edit.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/bug-tracker/www/admin/project-edit.tcl 5 Mar 2003 17:41:17 -0000 1.7 +++ openacs-4/packages/bug-tracker/www/admin/project-edit.tcl 28 Aug 2003 09:45:30 -0000 1.8 @@ -20,18 +20,17 @@ {name:text {html { size 50 }} {label "Project Name"} {help_text {This is also the name of this package in the site map}} } - {description:text(hidden) {label "Description"} optional {html { cols 50 rows 8 }} + {description:text(hidden),optional {label "Description"} {html { cols 50 rows 8 }} {help_text {This isn't actually used anywhere at this point. Sorry.}} } - {email_subject_name:text {html { size 50 }} {label "Notification tag"} optional + {email_subject_name:text,optional {html { size 50 }} {label "Notification tag"} {help_text {This text will be included in square brackets at the beginning of all notifications, for example \[OpenACS Bugs\]}} } - {maintainer:search + {maintainer:search,optional {result_datatype integer} {label {Project Maintainer}} {options [bug_tracker::users_get_options]} - optional - {search_query_name project_search} + {search_query {[db_map dbqd.acs-tcl.tcl.community-core-procs.user_search]}} } } -select_query_name project_select -edit_data { db_transaction { Index: openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.adp 22 May 2003 14:24:26 -0000 1.3 +++ openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.adp 28 Aug 2003 09:45:30 -0000 1.4 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context;noquote@ +@page_title@ +@context@ project_maintainer.maintainer Index: openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.tcl 5 Mar 2003 17:41:17 -0000 1.7 +++ openacs-4/packages/bug-tracker/www/admin/project-maintainer-edit.tcl 28 Aug 2003 09:45:30 -0000 1.8 @@ -16,11 +16,10 @@ ad_form -name project_maintainer -cancel_url $return_url -form { {return_url:text(hidden) {value $return_url}} - {maintainer:search + {maintainer:search,optional {result_datatype integer} {label {Project Maintainer}} {options [bug_tracker::users_get_options]} - optional {search_query { select distinct u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as name, u.user_id Index: openacs-4/packages/bug-tracker/www/admin/version-ae-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/Attic/version-ae-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/version-ae-oracle.xql 28 Mar 2003 15:15:16 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/version-ae-oracle.xql 28 Aug 2003 09:45:30 -0000 1.3 @@ -3,17 +3,16 @@ oracle8.1.6 - + select distinct u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as name, u.user_id from cc_users u - where upper(coalesce(u.first_names || ' ', '') || + where upper(nvl(u.first_names || ' ', '') || nvl(u.last_name || ' ', '') || u.email || ' ' || nvl(u.screen_name, '')) like upper('%'||:value||'%') order by name - Index: openacs-4/packages/bug-tracker/www/admin/version-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/Attic/version-ae-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/admin/version-ae-postgresql.xql 5 Mar 2003 17:41:17 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/admin/version-ae-postgresql.xql 28 Aug 2003 09:45:30 -0000 1.2 @@ -3,7 +3,7 @@ postgresql7.1 - + select distinct u.first_names || ' ' || u.last_name || ' (' || u.email || ')' as name, u.user_id from cc_users u Index: openacs-4/packages/bug-tracker/www/admin/version-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/version-ae.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/bug-tracker/www/admin/version-ae.adp 22 May 2003 14:24:26 -0000 1.3 +++ openacs-4/packages/bug-tracker/www/admin/version-ae.adp 28 Aug 2003 09:45:30 -0000 1.4 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context;noquote@ +@page_title@ +@context@ version.version_name Index: openacs-4/packages/bug-tracker/www/admin/version-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/version-ae.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/bug-tracker/www/admin/version-ae.tcl 5 Mar 2003 17:41:17 -0000 1.6 +++ openacs-4/packages/bug-tracker/www/admin/version-ae.tcl 28 Aug 2003 09:45:30 -0000 1.7 @@ -20,14 +20,13 @@ ad_form -name version -cancel_url $return_url -form { {version_id:key(acs_object_id_seq)} {version_name:text {label "Version name"} {html { size 50 }}} - {description:text(textarea) {label "Description"} optional {html { cols 50 rows 8 }}} - {supported_platforms:text {label "Supported platforms"} {html { size 50 }} optional} - {maintainer:search + {description:text(textarea),optional {label "Description"} {html { cols 50 rows 8 }}} + {supported_platforms:text,optional {label "Supported platforms"} {html { size 50 }}} + {maintainer:search,optional {result_datatype integer} {label "Maintainer"} {options {[bug_tracker::users_get_options]}} - optional - {search_query_name version_search} + {search_query {[db_map user_search]}} } {anticipated_freeze_date:date,to_sql(sql_date),to_html(sql_date),optional {label "Anticipated freeze"} optional @@ -41,7 +40,7 @@ {actual_release_date:date,to_sql(sql_date),to_html(sql_date),optional {label "Actual release"} optional } - {assignable_p:text(radio) {label "Assignable?"} optional {options {{Yes t} {No f}}}} + {assignable_p:text(radio),optional {label "Assignable?"} {options {{Yes t} {No f}}}} {return_url:text(hidden) {value $return_url}} } -select_query_name version_select -new_request { set assignable_p "t" Index: openacs-4/packages/bug-tracker/www/admin/version-release.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/version-release.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bug-tracker/www/admin/version-release.adp 22 May 2003 14:24:26 -0000 1.2 +++ openacs-4/packages/bug-tracker/www/admin/version-release.adp 28 Aug 2003 09:45:30 -0000 1.3 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context;noquote@ +@page_title@ +@context@ version.actual_release_date Index: openacs-4/packages/bug-tracker/www/admin/version-release.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/version-release.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/admin/version-release.tcl 5 Mar 2003 17:41:17 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/admin/version-release.tcl 28 Aug 2003 09:45:30 -0000 1.2 @@ -11,9 +11,8 @@ ad_form -name version -cancel_url versions -form { version_id:key {version_name:text {mode display} {label "Version Name"}} - {anticipated_release_date:date,to_sql(sql_date),to_html(sql_date) + {anticipated_release_date:date,to_sql(sql_date),to_html(sql_date),optional {mode display} {label "Anticipated release date"} - optional } {actual_release_date:date,to_sql(sql_date),to_html(sql_date) {label "Actual release date"} Index: openacs-4/packages/bug-tracker/www/admin/versions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/admin/versions.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/bug-tracker/www/admin/versions.adp 22 May 2003 14:24:26 -0000 1.3 +++ openacs-4/packages/bug-tracker/www/admin/versions.adp 28 Aug 2003 09:45:30 -0000 1.4 @@ -1,8 +1,8 @@ -@ Versions -@context_bar;noquote@ +@project_name@ Versions +@context_bar@ -

Current Version

+

In Development

None @@ -61,9 +61,6 @@ -

- The current version is the currently being developed on. -

Future Versions

@@ -129,7 +126,7 @@ Add new version -

Past Versions

+

Already Released Versions

None Index: openacs-4/packages/bug-tracker/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bug-tracker/www/doc/index.html,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bug-tracker/www/doc/index.html 24 Sep 2002 08:38:28 -0000 1.1 +++ openacs-4/packages/bug-tracker/www/doc/index.html 28 Aug 2003 09:45:30 -0000 1.2 @@ -11,8 +11,20 @@
  • Specification
  • +

    Version History

    + +
      +
    • + 1.2d10 Upgraded to work with updated 'workflow' package, where we've renamed workflow_case__delete to + workflow_case_pkg__delete to avoid conflict with old 'acs-workflow' package. +
    • +
    • + 1.2 Updated to use new 'workflow' package, and to also be configurable as a ticket-tracker. +
    • +
    +
    lars@pinds.com
    - \ No newline at end of file + Index: openacs-4/packages/bulk-mail/bulk-mail.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/bulk-mail.info,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/bulk-mail/bulk-mail.info 17 May 2003 10:19:06 -0000 1.4 +++ openacs-4/packages/bulk-mail/bulk-mail.info 28 Aug 2003 09:41:52 -0000 1.5 @@ -6,17 +6,16 @@ Bulk Mail f f + + + Yonatan Feldman + 2003-06-12 - - - oracle - postgresql - - Yonatan Feldman - - + + + Index: openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-create.sql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-create.sql 28 Aug 2003 09:41:52 -0000 1.2 @@ -18,12 +18,6 @@ default sysdate constraint bm_messages_send_date_nn not null, - sent_p char(1) - default 'f' - constraint bm_messages_sent_p_ck - check (sent_p in ('t', 'f')) - constraint bm_messages_sent_p_nn - not null, from_addr varchar(4000) constraint bm_messages_from_addr_nn not null, @@ -33,8 +27,14 @@ message clob constraint bm_messages_message_nn not null, - query varchar(4000) + query clob constraint bm_messages_query_nn + not null, + status varchar2(100) + default 'pending' + constraint bm_messages_status_ck + check (status in ('pending', 'sent')) + constraint bm_messages_status_nn not null ); Index: openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-package-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-package-create.sql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-package-create.sql 28 Aug 2003 09:41:52 -0000 1.2 @@ -13,7 +13,7 @@ package_id in bulk_mail_messages.package_id%TYPE, send_date in varchar default null, date_format in varchar default 'YYYY MM DD HH24 MI SS', - sent_p in bulk_mail_messages.sent_p%TYPE default 'f', + status in bulk_mail_messages.status%TYPE default 'pending', from_addr in bulk_mail_messages.from_addr%TYPE, subject in bulk_mail_messages.subject%TYPE default null, reply_to in bulk_mail_messages.reply_to%TYPE default null, @@ -42,7 +42,7 @@ package_id in bulk_mail_messages.package_id%TYPE, send_date in varchar default null, date_format in varchar default 'YYYY MM DD HH24 MI SS', - sent_p in bulk_mail_messages.sent_p%TYPE default 'f', + status in bulk_mail_messages.status%TYPE default 'pending', from_addr in bulk_mail_messages.from_addr%TYPE, subject in bulk_mail_messages.subject%TYPE default null, reply_to in bulk_mail_messages.reply_to%TYPE default null, @@ -78,12 +78,12 @@ insert into bulk_mail_messages (bulk_mail_id, package_id, - send_date, sent_p, + send_date, status, from_addr, subject, reply_to, extra_headers, message, query) values (v_bulk_mail_id, bulk_mail.new.package_id, - to_date(bulk_mail.new.send_date, bulk_mail.new.date_format), bulk_mail.new.sent_p, + to_date(bulk_mail.new.send_date, bulk_mail.new.date_format), bulk_mail.new.status, bulk_mail.new.from_addr, bulk_mail.new.subject, bulk_mail.new.reply_to, bulk_mail.new.extra_headers, bulk_mail.new.message, bulk_mail.new.query); Index: openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-views-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-views-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-views-create.sql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/sql/oracle/bulk-mail-views-create.sql 28 Aug 2003 09:41:52 -0000 1.2 @@ -9,10 +9,11 @@ as select bulk_mail_messages.* from bulk_mail_messages - where sent_p = 'f'; + where status = 'pending'; create or replace view bulk_mail_messages_sent as select bulk_mail_messages.* from bulk_mail_messages - where sent_p = 't'; + where status = 'sent'; + Index: openacs-4/packages/bulk-mail/sql/oracle/upgrade/upgrade-0.1a-0.2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/oracle/upgrade/upgrade-0.1a-0.2.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bulk-mail/sql/oracle/upgrade/upgrade-0.1a-0.2.sql 28 Aug 2003 09:41:52 -0000 1.2 @@ -0,0 +1,7 @@ +alter table bulk_mail_messages add (temp clob constraint temp_nn not null); +update bulk_mail_messages set temp = query; +alter table bulk_mail_messages drop column query cascade constraints; + +alter table bulk_mail_messages add (query clob constraint bm_messages_query_nn not null); +update bulk_mail_messages set query = temp; +alter table bulk_mail_messages drop column temp cascade constraints; Index: openacs-4/packages/bulk-mail/sql/oracle/upgrade/upgrade-0.3-0.4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/oracle/upgrade/upgrade-0.3-0.4.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bulk-mail/sql/oracle/upgrade/upgrade-0.3-0.4.sql 28 Aug 2003 09:41:52 -0000 1.2 @@ -0,0 +1,42 @@ +-- Changes to support HTML in bulk mail (work originally done by Mohan for +-- Sloanspace). + +-- this should be a 'not null' column, but you can't do that when the +-- table's not empty +alter table bulk_mail_messages +add status varchar2(100); + +-- mark all the messages that are already sent as such +update bulk_mail_messages +set status = 'sent' +where sent_p = 't'; + +alter table bulk_mail_messages +drop column sent_p; + +-- now we can do this without having all the previously sent messages get +-- suddenly marked as pending and sent again (don't ask me how I know this :) +alter table bulk_mail_messages +modify status default 'pending'; + +alter table bulk_mail_messages +add constraint bm_messages_status_ck +check (status in ('pending', 'sent')); + +-- recreate the views +create or replace view bulk_mail_messages_unsent +as + select bulk_mail_messages.* + from bulk_mail_messages + where status = 'pending'; + +create or replace view bulk_mail_messages_sent +as + select bulk_mail_messages.* + from bulk_mail_messages + where status = 'sent'; + + +-- lastly, we seem to have to do this because the package is invalidated by +-- the above steps +@@bulk-mail-package-create Index: openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql 12 Jun 2002 13:53:13 -0000 1.2 +++ openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-create.sql 28 Aug 2003 09:41:52 -0000 1.3 @@ -16,7 +16,7 @@ references apm_packages (package_id) constraint bm_messages_package_id_nn not null, - send_date date + send_date timestamptz default now() constraint bm_messages_send_date_nn not null, @@ -33,9 +33,14 @@ message text constraint bm_messages_message_nn not null, - query varchar(4000) + query text constraint bm_messages_query_nn + not null, + status varchar(100) + default 'pending' + constraint bm_messages_status_nn not null + ); -- create a new object type Index: openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-create.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-create.sql 17 May 2003 10:19:23 -0000 1.4 +++ openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-package-create.sql 28 Aug 2003 09:41:52 -0000 1.5 @@ -5,7 +5,7 @@ -- @version $Id$ -- -select define_function_args('bulk_mail__new','bulk_mail_id,package_id,send_date,date_format,sent_p;f,from_addr,subject,reply_to,extra_headers,message,query,creation_date;now(),creation_user,creation_ip,context_id'); +select define_function_args('bulk_mail__new','bulk_mail_id,package_id,send_date,date_format,status;pending,from_addr,subject,reply_to,extra_headers,message,query,creation_date;now(),creation_user,creation_ip,context_id'); create function bulk_mail__new (integer, integer, varchar, varchar, varchar, varchar, varchar, varchar, varchar, text, varchar, timestamptz, integer, varchar, integer) returns integer as ' @@ -14,7 +14,7 @@ bulk_mail__new__package_id alias for $2; bulk_mail__new__send_date alias for $3; -- default to null bulk_mail__new__date_format alias for $4; -- default to "YYYY MM DD HH24 MI SS" - bulk_mail__new__sent_p alias for $5; -- default to "f" + bulk_mail__new__status alias for $5; -- default to "pending" bulk_mail__new__from_addr alias for $6; bulk_mail__new__subject alias for $7; -- default to null bulk_mail__new__reply_to alias for $8; -- default to null @@ -28,7 +28,7 @@ v_bulk_mail_id integer; v_send_date varchar(4000); v_date_format varchar(4000); - v_sent_p boolean; + v_status varchar(100); begin v_bulk_mail_id := acs_object__new( @@ -51,20 +51,20 @@ into v_send_date; end if; - v_sent_p := bulk_mail__new__sent_p; - if v_sent_p is null then - v_sent_p := ''f''; + v_status := bulk_mail__new__status; + if v_status is null then + v_status := ''pending''; end if; insert into bulk_mail_messages (bulk_mail_id, package_id, - send_date, sent_p, + send_date, status, from_addr, subject, reply_to, extra_headers, message, query) values (v_bulk_mail_id, bulk_mail__new__package_id, - to_date(v_send_date, v_date_format), v_sent_p, + to_date(v_send_date, v_date_format), v_status, bulk_mail__new__from_addr, bulk_mail__new__subject, bulk_mail__new__reply_to, bulk_mail__new__extra_headers, bulk_mail__new__message, bulk_mail__new__query); Index: openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-views-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-views-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-views-create.sql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/sql/postgresql/bulk-mail-views-create.sql 28 Aug 2003 09:41:52 -0000 1.2 @@ -9,10 +9,10 @@ as select bulk_mail_messages.* from bulk_mail_messages - where sent_p = 'f'; + where status = 'pending'; create view bulk_mail_messages_sent as select bulk_mail_messages.* from bulk_mail_messages - where sent_p = 't'; + where status = 'sent'; Index: openacs-4/packages/bulk-mail/sql/postgresql/upgrade/upgrade-0.1a-0.2.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/upgrade/Attic/upgrade-0.1a-0.2.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bulk-mail/sql/postgresql/upgrade/upgrade-0.1a-0.2.sql 28 Aug 2003 09:41:52 -0000 1.2 @@ -0,0 +1,13 @@ +-- create the new query column as type 'text' +alter table bulk_mail_messages add column query2 text; + +alter table bulk_mail_messages alter column query2 set not null; + +-- update the rows +update bulk_mail_messages set query2 = query; + +-- drop the old column +alter table bulk_mail_messages drop column query cascade; + +-- rename the new column ot the correct name +alter table bulk_mail_messages rename column query2 to query; Index: openacs-4/packages/bulk-mail/sql/postgresql/upgrade/upgrade-0.2-0.3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/upgrade/Attic/upgrade-0.2-0.3.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bulk-mail/sql/postgresql/upgrade/upgrade-0.2-0.3.sql 28 Aug 2003 09:41:52 -0000 1.2 @@ -0,0 +1,9 @@ +-- send_date needs to be of type timestampz + +alter table bulk_mail_messages alter column send_date drop not null; +alter table bulk_mail_messages add column new_send_date timestamptz; +alter table bulk_mail_messages alter column new_send_date set default now(); +update bulk_mail_messages set new_send_date = send_date; +alter table bulk_mail_messages alter column new_send_date set not null; +alter table bulk_mail_messages drop column send_date; +alter table bulk_mail_messages rename column new_send_date to send_date; Index: openacs-4/packages/bulk-mail/sql/postgresql/upgrade/upgrade-0.3-0.4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/sql/postgresql/upgrade/Attic/upgrade-0.3-0.4.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bulk-mail/sql/postgresql/upgrade/upgrade-0.3-0.4.sql 28 Aug 2003 09:41:52 -0000 1.2 @@ -0,0 +1,38 @@ +-- Changes to support HTML in bulk mail (work originally done by Mohan for +-- Sloanspace). + +-- this should be a 'not null' column, but you can't do that when the +-- table's not empty +alter table bulk_mail_messages +add status varchar(100); + +-- mark all the messages that are already sent as such +update bulk_mail_messages +set status = 'sent' +where sent_p = 't'; + +alter table bulk_mail_messages +drop column sent_p; + +-- now we can do this without having all the previously sent messages get +-- suddenly marked as pending and sent again (don't ask me how I know this :) +alter table bulk_mail_messages +modify status default 'pending'; + +-- recreate the views +create or replace view bulk_mail_messages_unsent +as + select bulk_mail_messages.* + from bulk_mail_messages + where status = 'pending'; + +create or replace view bulk_mail_messages_sent +as + select bulk_mail_messages.* + from bulk_mail_messages + where status = 'sent'; + + +-- lastly, we seem to have to do this because the package is invalidated by +-- the above steps +@@bulk-mail-package-create Index: openacs-4/packages/bulk-mail/tcl/bulk-mail-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/tcl/bulk-mail-procs-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bulk-mail/tcl/bulk-mail-procs-oracle.xql 16 Jan 2003 13:44:51 -0000 1.2 +++ openacs-4/packages/bulk-mail/tcl/bulk-mail-procs-oracle.xql 28 Aug 2003 09:41:53 -0000 1.3 @@ -22,8 +22,9 @@ select bulk_mail_messages.* from bulk_mail_messages - where bulk_mail_messages.sent_p = 'f' + where bulk_mail_messages.status = 'pending' and bulk_mail_messages.send_date <= sysdate + for update Index: openacs-4/packages/bulk-mail/tcl/bulk-mail-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/tcl/bulk-mail-procs-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/bulk-mail/tcl/bulk-mail-procs-postgresql.xql 16 Jan 2003 13:44:51 -0000 1.2 +++ openacs-4/packages/bulk-mail/tcl/bulk-mail-procs-postgresql.xql 28 Aug 2003 09:41:53 -0000 1.3 @@ -21,8 +21,9 @@ select bulk_mail_messages.* from bulk_mail_messages - where bulk_mail_messages.sent_p = 'f' + where bulk_mail_messages.status = 'pending' and bulk_mail_messages.send_date <= now() + for update Index: openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.tcl 16 Jan 2003 13:44:51 -0000 1.5 +++ openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.tcl 28 Aug 2003 09:41:53 -0000 1.6 @@ -1,10 +1,10 @@ ad_library { - bulk mail procedure library + bulk_mail procedure library @author yon (yon@openforce.net) @creation-date 2002-05-07 - @cvs-id $Id$ + @version $Id$ } @@ -84,6 +84,7 @@ {-reply_to ""} {-extra_headers ""} {-message:required} + {-message_type ""} {-query:required} } { create a new bulk_mail message @@ -107,6 +108,7 @@ @param message the body of the email, can be overridden by a value selected in the query. will be interpolated with values from the query. + @param message_type - "text" or "html" (added by mohan) @param query a query that must select the email address to send to as 'email' and can select any other values that will be interpolated into the subject and message of the bulk_mail for @@ -155,8 +157,9 @@ ns_set put $extra_vars from_addr $from_addr ns_set put $extra_vars subject $subject ns_set put $extra_vars reply_to $reply_to - ns_set put $extra_vars extra_headers $extra_headers + ns_set put $extra_vars extra_headers "$extra_headers bulk-mail-type $message_type" ns_set put $extra_vars message $message + ns_set put $extra_vars message_type $message_type ns_set put $extra_vars query $query ns_set put $extra_vars context_id $package_id @@ -171,15 +174,17 @@ ns_log notice "bulk_mail::sweep starting" ## JCD: this transaction is misguided since any code - ## errors in any procs below would cause the messages + ## errors in any procs below would cause the messages ## already sent to be marked unsent. Also, it seems to - ## cause locking problems on oracle + ## cause locking problems on oracle ## (per Caroline Meeks ## http://openacs.org/bugtracker/openacs/bug?bug_number=93 #db_transaction { - foreach bulk_mail [db_list_of_ns_sets select_bulk_mails_to_send {}] { + #Although the message may change for each recipiant, it usually doesn't. We check by looking to see if message_old = the current messag. This is inicialized here for each bulk_mail. + set message_old "" + foreach recipient [db_list_of_ns_sets select_bulk_mail_recipients [ns_set get $bulk_mail query]] { # create a list of key, value pairs that will be used to @@ -225,18 +230,52 @@ set message [ns_set get $recipient message] } + # mohan's hack to fix the passing of message type for the + # mail. + # Comment: I have to ask Caroline or Andrew if itis ok to + # change bulk-mail datamodel to accomodate message_type. + + set extra_headers [util_list_to_ns_set [ns_set get $bulk_mail extra_headers]] + set message_type [ns_set get $extra_headers bulk-mail-type] + + # don't need this anymore and don't want to send it along + ns_set delkey $extra_headers bulk-mail-type + # interpolate the key, value pairs (as described above) # into the message body set message [interpolate -values $pairs -text $message] - # send the message reliably - acs_mail_lite::send \ - -to_addr [ns_set get $recipient email] \ - -from_addr $from_addr \ - -subject $subject \ - -body $message \ - -extraheaders [util_list_to_ns_set [ns_set get $bulk_mail extra_headers]] + if {$message_type == "html"} { + if {[string compare $message_old $message] != 0} { + # If this message is different then the last loop + # we set up the html and text messages. Note that + # ad_html_text_convert can get quite expensive, + # if you start sending different long html + # messages created by microsoft word to each of + # over 100 users, expect performance problems. + # the from to html closes any open tags. + set message_html [ad_html_text_convert -from html -to html $message] + # some mailers are chopping off the last few characters. + append message_html " " + set message_text [ad_html_text_convert -from html -to text $message] + set message_old $message + } + + set message_data [build_mime_message $message_text $message_html] + ns_set put $extra_headers MIME-Version [ns_set get $message_data MIME-Version] + ns_set put $extra_headers Content-ID [ns_set get $message_data Content-ID] + ns_set put $extra_headers Content-Type [ns_set get $message_data Content-Type] + set message [ns_set get $message_data body] + } + + # both html and plain messages can now be sent the same way + acs_mail_lite::send \ + -to_addr [ns_set get $recipient email] \ + -from_addr $from_addr \ + -subject $subject \ + -body $message \ + -extraheaders $extra_headers } # mark the bulk_mail as sent so that we don't process it again Index: openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.xql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/tcl/bulk-mail-procs.xql 28 Aug 2003 09:41:53 -0000 1.2 @@ -12,7 +12,7 @@ update bulk_mail_messages - set sent_p = 't' + set status = 'sent' where bulk_mail_id = :bulk_mail_id Index: openacs-4/packages/bulk-mail/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/www/index.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/bulk-mail/www/index.tcl 18 Nov 2002 18:01:15 -0000 1.9 +++ openacs-4/packages/bulk-mail/www/index.tcl 28 Aug 2003 09:41:53 -0000 1.10 @@ -20,11 +20,11 @@ set context [list All] set table_def [list \ - [list send_date "[_ bulk-mail.Send_Date]" {bulk_mail_messages.send_date $order} {[lc_time_fmt $send_date "%q"]}] \ - [list from_addr "[_ bulk-mail.From]" {bulk_mail_messages.from_addr $order} {$from_addr}] \ - [list subject "[_ bulk-mail.Subject]" {bulk_mail_messages.subject $order} {$subject}] \ - [list sent_p "[_ bulk-mail.Sent]" {bulk_mail_messages.sent_p $order} {[ad_decode $sent_p t [_ bulk-mail.Yes] [_ bulk-mail.No]]}] \ -] + [list send_date [_ bulk-mail.Send_Date] {bulk_mail_messages.send_date $order} {[lc_time_fmt $send_date "%q"]}] \ + [list from_addr [_ bulk-mail.From] {bulk_mail_messages.from_addr $order} {$from_addr}] \ + [list subject [_ bulk-mail.Subject] {bulk_mail_messages.subject $order} {$subject}] \ + [list status [_ bulk-mail.Sent] {bulk_mail_messages.status $order} {[ad_decode $status sent [_ bulk-mail.Yes] [_ bulk-mail.No]]}] \ + ] set sql " select bulk_mail_messages.* Index: openacs-4/packages/bulk-mail/www/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/www/one.adp,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/bulk-mail/www/one.adp 22 May 2003 14:25:02 -0000 1.8 +++ openacs-4/packages/bulk-mail/www/one.adp 28 Aug 2003 09:41:53 -0000 1.9 @@ -33,7 +33,7 @@ #bulk-mail.Sent# - #bulk-mail.Yes##bulk-mail.No# + #bulk-mail.Yes##bulk-mail.No# Index: openacs-4/packages/bulk-mail/www/one.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bulk-mail/www/one.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/bulk-mail/www/one.xql 15 May 2002 22:07:52 -0000 1.1 +++ openacs-4/packages/bulk-mail/www/one.xql 28 Aug 2003 09:41:53 -0000 1.2 @@ -6,7 +6,7 @@ select bulk_mail_messages.bulk_mail_id, to_char(bulk_mail_messages.send_date, 'Mon DD YYYY HH24:MI') as send_date, - bulk_mail_messages.sent_p, + bulk_mail_messages.status, bulk_mail_messages.from_addr, bulk_mail_messages.subject, bulk_mail_messages.reply_to, Index: openacs-4/packages/ecommerce/tcl/ecommerce-email-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-email-procs.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/ecommerce/tcl/ecommerce-email-procs.xql 26 May 2002 04:36:49 -0000 1.4 +++ openacs-4/packages/ecommerce/tcl/ecommerce-email-procs.xql 28 Aug 2003 09:41:53 -0000 1.5 @@ -2,25 +2,26 @@ - + select subject as email_subject, message as email_body, issue_type_list from ec_email_templates where email_template_id = 1 - + select ep.email_on_purchase_list, ep.product_name from ec_items ei, ec_products ep where ei.product_id = ep.product_id and ei.order_id = :order_id + and email_on_purchase_list is not null group by ep.email_on_purchase_list, ep.product_name - + select u.email, u.user_id from ec_orders, cc_users u @@ -29,15 +30,15 @@ - + select subject as email_subject, message as email_body, issue_type_list from ec_email_templates where email_template_id = 3 - + select u.email, u.user_id, s.shipment_date, s.address_id, o.order_state, o.order_id from ec_orders o, cc_users u, ec_shipments s @@ -47,7 +48,7 @@ - + select p.product_name, p.one_line_description, p.product_id, i.price_charged, i.price_name, count(*) as quantity from ec_items i, ec_products p @@ -57,15 +58,15 @@ - + select subject as email_subject, message as email_body, issue_type_list from ec_email_templates where email_template_id = 2 - + select g.purchased_by as user_id, u.email, g.recipient_email, g.amount from ec_gift_certificates g, cc_users u @@ -74,15 +75,15 @@ - + select subject as email_subject, message as email_body, issue_type_list from ec_email_templates where email_template_id = 4 - + select g.purchased_by as user_id, u.email, g.recipient_email, g.amount, g.certificate_to, g.certificate_from, g.certificate_message from ec_gift_certificates g, cc_users u @@ -91,43 +92,43 @@ - + select subject as email_subject, message as email_body, issue_type_list from ec_email_templates where email_template_id = 6 - + select g.recipient_email as email, g.amount, g.certificate_to, g.certificate_from, g.certificate_message, g.claim_check from ec_gift_certificates g where g.gift_certificate_id=:gift_certificate_id - + select subject as email_subject, message as email_body, issue_type_list from ec_email_templates where email_template_id=5 - + select user_id from cc_users where email=lower(:email) - + select user_identification_id from ec_user_identification where email=lower(:email) - + insert into ec_user_identification (user_identification_id, email) Index: openacs-4/packages/ecommerce/tcl/ecommerce-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-procs-oracle.xql,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/ecommerce/tcl/ecommerce-procs-oracle.xql 23 Sep 2002 20:43:26 -0000 1.10 +++ openacs-4/packages/ecommerce/tcl/ecommerce-procs-oracle.xql 28 Aug 2003 09:41:53 -0000 1.11 @@ -40,6 +40,14 @@ + + + select category_id, subcategory_id, subsubcategory_id, product_id + from ($common_sql) as dummy + where rownum < 2 + + + select decode(sign(sysdate-available_date),1,1,null,1,0) as available_p, Index: openacs-4/packages/ecommerce/tcl/ecommerce-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-procs-postgresql.xql,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/ecommerce/tcl/ecommerce-procs-postgresql.xql 16 Jan 2003 13:46:35 -0000 1.11 +++ openacs-4/packages/ecommerce/tcl/ecommerce-procs-postgresql.xql 28 Aug 2003 09:41:53 -0000 1.12 @@ -40,6 +40,14 @@ + + + select category_id, subcategory_id, subsubcategory_id, product_id + from ($common_sql) as dummy + limit 1 + + + select case when current_timestamp > available_date then 1 when current_timestamp-available_date is NULL then 1 else 0 end as available_p, Index: openacs-4/packages/ecommerce/tcl/ecommerce-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-procs.tcl,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/ecommerce/tcl/ecommerce-procs.tcl 3 Oct 2002 17:31:35 -0000 1.19 +++ openacs-4/packages/ecommerce/tcl/ecommerce-procs.tcl 28 Aug 2003 09:41:53 -0000 1.20 @@ -367,46 +367,25 @@ } } -# returns a link for the user to add him/herself to the mailing list for whatever category/ -# subcategory/subsubcategory a product is in. -# If the product is multiply categorized, this will just use the first categorization that -# Oracle finds for this product. ad_proc ec_mailing_list_link_for_a_product { product_id } { -returns a link for the user to add him/herself to the mailing list for whatever category/subcategory/subsubcategory a product is in. -If the product is multiply categorized, this will just use the first categorization that Oracle finds for this product. + + Returns a link for the user to add him/herself to the mailing + list for whatever category/subcategory/subsubcategory a product + is in. If the product is multiply categorized, this will just + use the first categorization that the DB finds for this product. + } { set category_id "" set subcategory_id "" set subsubcategory_id "" - db_foreach category_id_select { - select category_id from ec_category_product_map where product_id = :product_id - } { - - db_foreach subcategory_id_select { - select s.subcategory_id - from ec_subcategory_product_map m, - ec_subcategories s - where m.subcategory_id = s.subcategory_id - and s.category_id = :category_id - and m.product_id = :product_id - } { - - db_foreach subsubcategory_id_select { - select ss.subsubcategory_id - from ec_subsubcategory_product_map m, - ec_subsubcategories ss - where m.subsubcategory_id = ss.subsubcategory_id - and ss.subcategory_id = :subcategory_id - and m.product_id = :product_id - } { } - } - } + set common_sql [db_map mailing_categories_common] + db_0or1row mailing_categories {} if { ![empty_string_p $category_id] || ![empty_string_p $subcategory_id] || ![empty_string_p $subsubcategory_id] } { - return "Add yourself to the [ec_full_categorization_display $category_id $subcategory_id $subsubcategory_id] mailing list!" + return "Add yourself to the [ec_full_categorization_display $category_id $subcategory_id $subsubcategory_id] mailing list!" } else { - return "" + return "" } } @@ -563,7 +542,8 @@ $end_of_comment_query " { - append comments_to_print "$email rated this product [ec_display_rating $rating] on $last_modified_pretty and wrote:
    + array set person [person::get -person_id $user_id] + append comments_to_print "$person(first_names) $person(last_name) rated this product [ec_display_rating $rating] on $last_modified_pretty and wrote:
    $one_line_summary
    $user_comment

    Index: openacs-4/packages/ecommerce/tcl/ecommerce-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-procs.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/ecommerce/tcl/ecommerce-procs.xql 26 May 2002 04:36:49 -0000 1.6 +++ openacs-4/packages/ecommerce/tcl/ecommerce-procs.xql 28 Aug 2003 09:41:53 -0000 1.7 @@ -151,15 +151,24 @@ - + - select ss.subsubcategory_id - from ec_subsubcategory_product_map m, ec_subsubcategories ss - where m.subsubcategory_id = ss.subsubcategory_id - and ss.subcategory_id = :subcategory_id - and m.product_id = :product_id + (select cpm.category_id, bla.subcategory_id, cpm.product_id + from ec_category_product_map cpm + left join (select sc.category_id, spm.subcategory_id, spm.product_id + from ec_subcategory_product_map spm, ec_subcategories sc + where sc.subcategory_id = spm.subcategory_id) as bla + using (category_id, product_id) + where cpm.product_id = :product_id + ) as bogus + left join (select sc.category_id, ssc.subcategory_id, sspm.subsubcategory_id, sspm.product_id + from ec_subsubcategory_product_map sspm, ec_subcategories sc, ec_subsubcategories ssc + where sspm.subsubcategory_id = ssc.subsubcategory_id + and ssc.subcategory_id = sc.subcategory_id + ) as boring + using (category_id, subcategory_id, product_id) - + Index: openacs-4/packages/ecommerce/www/admin/products/edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/edit-2.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/ecommerce/www/admin/products/edit-2.tcl 10 Sep 2002 22:22:45 -0000 1.3 +++ openacs-4/packages/ecommerce/www/admin/products/edit-2.tcl 28 Aug 2003 09:41:53 -0000 1.4 @@ -451,7 +451,7 @@ " # also need to export custom field values -db_foreach custom_fields_select "select field_identifier from ec_custom_product_fields where active_p='t'" { +db_foreach custom_fields_export "select field_identifier from ec_custom_product_fields where active_p='t'" { if { [info exists ec_custom_fields($field_identifier)] } { doc_body_append "\n" } Index: openacs-4/packages/ecommerce/www/admin/products/edit-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/edit-2.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/ecommerce/www/admin/products/edit-2.xql 10 Jul 2001 20:33:53 -0000 1.1 +++ openacs-4/packages/ecommerce/www/admin/products/edit-2.xql 28 Aug 2003 09:41:53 -0000 1.2 @@ -45,7 +45,7 @@ - + select field_identifier from ec_custom_product_fields where active_p='t' Index: openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-create.sql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-create.sql 17 May 2003 10:30:52 -0000 1.7 +++ openacs-4/packages/edit-this-page/sql/oracle/edit-this-page-create.sql 28 Aug 2003 09:41:53 -0000 1.8 @@ -442,3 +442,19 @@ end; / show errors; + + +-- create a default content_type etp_page_revision +-- DaveB +-- this references a non-existant table +-- which I might have to change... + +select content_type__create_type ( + content_type => 'etp_page_revision', -- content_type + supertype => 'content_revision', -- supertype + pretty_name => 'ETP managed page', -- pretty_name + pretty_plural => 'ETP managed pages', -- pretty_plural + table_name => 'etp_page_revisions', -- table_name + id_column => 'etp_page_revision_id', -- id_column + name_method => 'content_revision__revision_name' -- name_method +); Index: openacs-4/packages/edit-this-page/tcl/etp-sc-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/tcl/etp-sc-procs-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/edit-this-page/tcl/etp-sc-procs-postgresql.xql 4 Apr 2003 15:20:28 -0000 1.2 +++ openacs-4/packages/edit-this-page/tcl/etp-sc-procs-postgresql.xql 28 Aug 2003 09:41:53 -0000 1.3 @@ -24,7 +24,7 @@ 'FtsContentProvider', -- impl_contract_name :content_type, -- impl_name 'datasource', -- impl_operation_name - 'etp_page_revision__datasource', -- impl_alias + 'etp::revision_datasource', -- impl_alias 'TCL' -- impl_pl ) @@ -36,7 +36,7 @@ 'FtsContentProvider', -- impl_contract_name :content_type, -- impl_name 'url', -- impl_operation_name - 'etp_page_revision__url', -- impl_alias + 'etp::revision_url', -- impl_alias 'TCL' -- impl_pl ); Index: openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql 17 May 2003 10:37:05 -0000 1.5 +++ openacs-4/packages/file-storage/sql/oracle/file-storage-package-create.sql 28 Aug 2003 09:41:53 -0000 1.6 @@ -75,7 +75,9 @@ -- Move a file, and all its versions, to a new folder -- file_id in cr_items.item_id%TYPE, - target_folder_id in cr_items.parent_id%TYPE + target_folder_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE ); function get_title( @@ -305,7 +307,7 @@ ); end if; - acs_object.update_last_modified(file_storage.new_file.folder_id); + acs_object.update_last_modified(file_storage.new_file.folder_id,new_file.creation_user,new_file.creation_ip); return v_item_id; end new_file; @@ -400,7 +402,7 @@ content_length = v_content_length where revision_id = v_new_version_id; - acs_object.update_last_modified(file_storage.copy_file.target_folder_id); + acs_object.update_last_modified(file_storage.copy_file.target_folder_id,file_storage.copy_file.creation_user,file_storage.copy_file.creation_ip); return v_new_version_id; end copy_file; @@ -410,7 +412,9 @@ -- Move a file, and all its versions, to a new folder -- file_id in cr_items.item_id%TYPE, - target_folder_id in cr_items.parent_id%TYPE + target_folder_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE ) is begin @@ -419,7 +423,7 @@ target_folder_id => file_storage.move_file.target_folder_id ); - acs_object.update_last_modified(file_storage.move_file.target_folder_id); + acs_object.update_last_modified(file_storage.move_file.target_folder_id,file_storage.move_file.creation_user,file_storage.move_file.creation_ip); end; @@ -457,7 +461,7 @@ from cr_items where cr_items.item_id = file_storage.new_version.item_id; - acs_object.update_last_modified(v_folder_id); + acs_object.update_last_modified(v_folder_id,new_version.creation_user,new_version.creation_ip); return v_revision_id; Index: openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.6.2-4.6.3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.6.2-4.6.3.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.6.2-4.6.3.sql 28 Aug 2003 09:41:53 -0000 1.2 @@ -0,0 +1,708 @@ +-- Need to recreate package, to add user and IP to update_last_modified +-- $Id + +create or replace package file_storage +as + + function get_root_folder( + -- + -- Returns the root folder corresponding to a particular + -- package instance. + -- + package_id in apm_packages.package_id%TYPE + ) return fs_root_folders.folder_id%TYPE; + + function get_package_id( + item_id in cr_items.item_id%TYPE + ) return fs_root_folders.package_id%TYPE; + + function new_root_folder( + -- + -- Creates a new root folder + -- + package_id in apm_packages.package_id%TYPE, + folder_name in cr_folders.label%TYPE default null, + description in cr_folders.description%TYPE default null + ) return fs_root_folders.folder_id%TYPE; + + function new_file( + -- + -- Create a file in CR in preparation for actual storage + -- Wrapper for content_item.new + -- + item_id in cr_items.item_id%TYPE default null, + title in cr_items.name%TYPE, + folder_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE, + indb_p in char default 't' + ) return cr_items.item_id%TYPE; + + procedure delete_file( + -- + -- Delete a file and all its version + -- Wrapper to content_item.delete + -- + file_id in cr_items.item_id%TYPE + ); + + procedure rename_file( + -- + -- Rename a file and all + -- Wrapper to content_item__rename + -- + file_id in cr_items.item_id%TYPE, + title in cr_items.name%TYPE + ); + + function copy_file( + -- + -- Copy a file, but only copy the live_revision + -- + file_id in cr_items.item_id%TYPE, + target_folder_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE + ) return cr_revisions.revision_id%TYPE; + + procedure move_file( + -- + -- Move a file, and all its versions, to a new folder + -- + file_id in cr_items.item_id%TYPE, + target_folder_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE + ); + + function get_title( + -- + -- Unfortunately, title in the file-storage context refers + -- to the name attribute in cr_items, not the title attribute in + -- cr_revisions + item_id in cr_items.item_id%TYPE + ) return varchar; + + function get_parent_id( + item_id in cr_items.item_id%TYPE + ) return cr_items.item_id%TYPE; + + function get_content_type( + -- + -- Wrapper for content_item. get_content_type + -- + item_id in cr_items.item_id%TYPE + ) return cr_items.content_type%TYPE; + + function get_folder_name( + -- + -- Wrapper for content_folder__get_label + -- + folder_id in cr_folders.folder_id%TYPE + ) return cr_folders.label%TYPE; + + function new_version( + -- + -- Create a new version of a file + -- Wrapper for content_revision.new + -- + filename in cr_revisions.title%TYPE, + description in cr_revisions.description%TYPE, + mime_type in cr_revisions.mime_type%TYPE, + item_id in cr_items.item_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE + ) return cr_revisions.revision_id%TYPE; + + function delete_version( + -- + -- Delete a version of a file + -- + file_id in cr_items.item_id%TYPE, + version_id in cr_revisions.revision_id%TYPE + ) return cr_items.parent_id%TYPE; + + function new_folder( + -- + -- Create a folder + -- + name in cr_items.name%TYPE, + folder_name in cr_folders.label%TYPE, + parent_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE + ) return cr_folders.folder_id%TYPE; + + procedure delete_folder( + -- + -- Delete a folder + -- + folder_id in cr_folders.folder_id%TYPE + ); + +end file_storage; +/ +show errors + +create or replace package body file_storage +as + + function get_root_folder( + package_id in apm_packages.package_id%TYPE + ) return fs_root_folders.folder_id%TYPE + is + v_folder_id fs_root_folders.folder_id%TYPE; + v_count integer; + begin + select count(*) + into v_count + from fs_root_folders + where package_id = get_root_folder.package_id; + + if v_count > 0 then + select folder_id + into v_folder_id + from fs_root_folders + where package_id = get_root_folder.package_id; + else + -- must be a new instance. Gotta create a new root folder + v_folder_id := new_root_folder(package_id); + end if; + + return v_folder_id; + end get_root_folder; + + function get_package_id( + item_id in cr_items.item_id%TYPE + ) return fs_root_folders.package_id%TYPE + is + v_package_id fs_root_folders.package_id%TYPE; + begin + select fs_root_folders.package_id + into v_package_id + from fs_root_folders, + (select cr_items.item_id + from cr_items + connect by prior cr_items.parent_id = cr_items.item_id + start with cr_items.item_id = get_package_id.item_id) this + where fs_root_folders.folder_id = this.item_id; + + return v_package_id; + + exception when NO_DATA_FOUND then + return null; + end get_package_id; + + function new_root_folder( + -- + -- A hackish function to get around the fact that we can't run + -- code automatically when a new package instance is created. + -- + package_id in apm_packages.package_id%TYPE, + folder_name in cr_folders.label%TYPE default null, + description in cr_folders.description%TYPE default null + ) return fs_root_folders.folder_id%TYPE + is + v_folder_id fs_root_folders.folder_id%TYPE; + v_package_name apm_packages.instance_name%TYPE; + v_package_key apm_packages.package_key%TYPE; + v_folder_name cr_folders.label%TYPE; + v_description cr_folders.description%TYPE; + begin + select instance_name, package_key + into v_package_name, v_package_key + from apm_packages + where package_id = new_root_folder.package_id; + + if new_root_folder.folder_name is null + then + v_folder_name := v_package_name || ' Root Folder'; + else + v_folder_name := folder_name; + end if; + + if new_root_folder.description is null + then + v_description := 'Root folder for the file-storage system. All other folders in file storage are subfolders of this one.'; + else + v_description := description; + end if; + + v_folder_id := content_folder.new( + name => v_package_key || '_' || package_id, + label => v_folder_name, + description => v_description + ); + + insert + into fs_root_folders + (package_id, folder_id) + values + (package_id, v_folder_id); + + -- allow child items to be added + content_folder.register_content_type(v_folder_id,'content_revision','t'); + content_folder.register_content_type(v_folder_id,'content_folder','t'); + content_folder.register_content_type(v_folder_id,'content_extlink','t'); + content_folder.register_content_type(v_folder_id,'content_symlink','t'); + + -- set up default permissions + acs_permission.grant_permission( + object_id => v_folder_id, + grantee_id => acs.magic_object_id('the_public'), + privilege => 'read' + ); + + acs_permission.grant_permission( + object_id => v_folder_id, + grantee_id => acs.magic_object_id('registered_users'), + privilege => 'write' + ); + + return v_folder_id; + end new_root_folder; + + function new_file( + -- + -- Create a file in CR in preparation for actual storage + -- Wrapper for content_item.new + -- + item_id in cr_items.item_id%TYPE default null, + title in cr_items.name%TYPE, + folder_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE, + indb_p in char default 't' + ) return cr_items.item_id%TYPE + is + v_item_id cr_items.item_id%TYPE; + begin + if new_file.indb_p = 't' + then + v_item_id := content_item.new( + item_id => new_file.item_id, + name => new_file.title, + parent_id => new_file.folder_id, + creation_user => new_file.creation_user, + context_id => new_file.folder_id, + creation_ip => new_file.creation_ip, + content_type => 'file_storage_object', + item_subtype => 'content_item' + ); + else + v_item_id := content_item.new( + name => new_file.title, + parent_id => new_file.folder_id, + creation_user => new_file.creation_user, + context_id => new_file.folder_id, + creation_ip => new_file.creation_ip, + content_type => 'file_storage_object', + item_subtype => 'content_item', + storage_type => 'file' + ); + end if; + + acs_object.update_last_modified(file_storage.new_file.folder_id,new_file.creation_user,new_file.creation_ip); + + return v_item_id; + end new_file; + + procedure delete_file( + -- + -- Delete a file and all its version + -- Wrapper to content_item__delete + -- + file_id in cr_items.item_id%TYPE + ) + is + begin + content_item.delete(item_id => file_storage.delete_file.file_id); + end delete_file; + + procedure rename_file( + -- + -- Rename a file and all + -- Wrapper to content_item__rename + -- + file_id in cr_items.item_id%TYPE, + title in cr_items.name%TYPE + ) + is + begin + content_item.rename( + item_id => file_storage.rename_file.file_id, + name => file_storage.rename_file.title + ); + end rename_file; + + function copy_file( + -- + -- Copy a file, but only copy the live_revision + -- + file_id in cr_items.item_id%TYPE, + target_folder_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE + ) return cr_revisions.revision_id%TYPE + is + v_title cr_items.name%TYPE; + v_live_revision cr_items.live_revision%TYPE; + v_filename cr_revisions.title%TYPE; + v_description cr_revisions.description%TYPE; + v_mime_type cr_revisions.mime_type%TYPE; + v_content_length cr_revisions.content_length%TYPE; + v_lob cr_revisions.content%TYPE; + v_file_path cr_revisions.filename%TYPE; + v_new_file_id cr_items.item_id%TYPE; + v_new_version_id cr_revisions.revision_id%TYPE; + v_indb_p char; + begin + -- We copy only the title from the file being copied, and attributes of the + -- live revision + select i.name, i.live_revision, r.title, r.description, + r.mime_type, r.content, r.filename, r.content_length, + decode(i.storage_type,'lob','t','f') + into v_title, v_live_revision, v_filename, v_description, + v_mime_type, v_lob, v_file_path, v_content_length, + v_indb_p + from cr_items i, cr_revisions r + where r.item_id = i.item_id + and r.revision_id = i.live_revision + and i.item_id = file_storage.copy_file.file_id; + + -- We should probably use the copy functions of CR + -- when we optimize this function + v_new_file_id := file_storage.new_file( + title => v_title, + folder_id => file_storage.copy_file.target_folder_id, + creation_user => file_storage.copy_file.creation_user, + creation_ip => file_storage.copy_file.creation_ip, + indb_p => v_indb_p + ); + + v_new_version_id := file_storage.new_version( + filename => v_filename, + description => v_description, + mime_type => v_mime_type, + item_id => v_new_file_id, + creation_user => file_storage.copy_file.creation_user, + creation_ip => file_storage.copy_file.creation_ip + ); + + -- Oracle is easier, since lobs are true lobs + -- For now, we simply copy the file name + update cr_revisions + set filename = v_file_path, + content = v_lob, + content_length = v_content_length + where revision_id = v_new_version_id; + + acs_object.update_last_modified(file_storage.copy_file.target_folder_id,file_storage.copy_file.creation_user,file_storage.copy_file.creation_ip); + + return v_new_version_id; + end copy_file; + + procedure move_file( + -- + -- Move a file, and all its versions, to a new folder + -- + file_id in cr_items.item_id%TYPE, + target_folder_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE + ) + is + begin + content_item.move( + item_id => file_storage.move_file.file_id, + target_folder_id => file_storage.move_file.target_folder_id + ); + + acs_object.update_last_modified(file_storage.move_file.target_folder_id,file_storage.move_file.creation_user,file_storage.move_file.creation_ip); + + end; + + function new_version( + -- + -- Create a new version of a file + -- Wrapper for content_revision.new + -- + filename in cr_revisions.title%TYPE, + description in cr_revisions.description%TYPE, + mime_type in cr_revisions.mime_type%TYPE, + item_id in cr_items.item_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE + ) return cr_revisions.revision_id%TYPE + is + v_revision_id cr_revisions.revision_id%TYPE; + v_folder_id cr_items.parent_id%TYPE; + begin + -- Create a revision + v_revision_id := content_revision.new( + title => new_version.filename, + description => new_version.description, + mime_type => new_version.mime_type, + item_id => new_version.item_id, + creation_user => new_version.creation_user, + creation_ip => new_version.creation_ip + ); + + -- Make live the newly created revision + content_item.set_live_revision(revision_id => v_revision_id); + + select cr_items.parent_id + into v_folder_id + from cr_items + where cr_items.item_id = file_storage.new_version.item_id; + + acs_object.update_last_modified(v_folder_id,new_version.creation_user,new_version.creation_ip); + + return v_revision_id; + + exception when NO_DATA_FOUND then + return v_revision_id; + end new_version; + + function get_title( + -- + -- Unfortunately, title in the file-storage context refers + -- to the name attribute in cr_items, not the title attribute in + -- cr_revisions + item_id in cr_items.item_id%TYPE + ) return varchar + is + v_title cr_items.name%TYPE; + v_content_type cr_items.content_type%TYPE; + begin + select content_type + into v_content_type + from cr_items + where item_id = get_title.item_id; + + if v_content_type = 'content_folder' + then + select label + into v_title + from cr_folders + where folder_id = get_title.item_id; + else if v_content_type = 'content_symlink' + then + select label into v_title + from cr_symlinks + where symlink_id = get_title.item_id; + else + select name into v_title + from cr_items + where item_id = get_title.item_id; + end if; + end if; + + return v_title; + end get_title; + + function get_parent_id( + item_id in cr_items.item_id%TYPE + ) return cr_items.item_id%TYPE + is + v_parent_id cr_items.item_id%TYPE; + begin + select parent_id + into v_parent_id + from cr_items + where item_id = get_parent_id.item_id; + + return v_parent_id; + end get_parent_id; + + function get_content_type( + -- + -- Wrapper for content_item. get_content_type + -- + item_id in cr_items.item_id%TYPE + ) return cr_items.content_type%TYPE + is + v_content_type cr_items.content_type%TYPE; + begin + v_content_type := content_item.get_content_type( + item_id => file_storage.get_content_type.item_id + ); + + return v_content_type; + end get_content_type; + + function get_folder_name( + -- + -- Wrapper for content_folder.get_label + -- + folder_id in cr_folders.folder_id%TYPE + ) return cr_folders.label%TYPE + is + v_folder_name cr_folders.label%TYPE; + begin + v_folder_name := content_folder.get_label( + folder_id => file_storage.get_folder_name.folder_id + ); + + return v_folder_name; + end get_folder_name; + + function delete_version( + -- + -- Delete a version of a file + -- + file_id in cr_items.item_id%TYPE, + version_id in cr_revisions.revision_id%TYPE + ) return cr_items.parent_id%TYPE + is + v_parent_id cr_items.parent_id%TYPE; + begin + if file_storage.delete_version.version_id = content_item.get_live_revision(file_storage.delete_version.file_id) + then + content_revision.delete(file_storage.delete_version.version_id); + content_item.set_live_revision( + content_item.get_latest_revision(file_storage.delete_version.file_id) + ); + else + content_revision.delete(file_storage.delete_version.version_id); + end if; + + -- If the live revision is null, we have deleted the last version above + select decode(live_revision, null, parent_id, 0) + into v_parent_id + from cr_items + where item_id = file_storage.delete_version.file_id; + + -- Unfortunately, due to PostgreSQL behavior with regards referential integrity, + -- we cannot delete the content_item entry if there are no more revisions. + return v_parent_id; + end delete_version; + + function new_folder( + -- + -- Create a folder + -- + name in cr_items.name%TYPE, + folder_name in cr_folders.label%TYPE, + parent_id in cr_items.parent_id%TYPE, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE + ) return cr_folders.folder_id%TYPE + is + v_folder_id cr_folders.folder_id%TYPE; + begin + -- Create a new folder + v_folder_id := content_folder.new( + name => file_storage.new_folder.name, + label => file_storage.new_folder.folder_name, + parent_id => file_storage.new_folder.parent_id, + creation_user => file_storage.new_folder.creation_user, + creation_ip => file_storage.new_folder.creation_ip + ); + + -- register the standard content types + content_folder.register_content_type( + v_folder_id, -- folder_id + 'content_revision', -- content_type + 't' -- include_subtypes + ); + + content_folder.register_content_type( + v_folder_id, -- folder_id + 'content_folder', -- content_type + 't' -- include_subtypes + ); + + content_folder.register_content_type( + v_folder_id, -- folder_id + 'content_extlink', -- content_type + 't' -- include_subtypes + ); + + content_folder.register_content_type( + v_folder_id, -- folder_id + 'content_symlink', -- content_type + 't' -- include_subtypes + ); + + -- Give the creator admin privileges on the folder + acs_permission.grant_permission( + v_folder_id, -- object_id + file_storage.new_folder.creation_user, -- grantee_id + 'admin' -- privilege + ); + + return v_folder_id; + end new_folder; + + procedure delete_folder( + -- + -- Delete a folder + -- + folder_id in cr_folders.folder_id%TYPE + ) + is + begin + content_folder.delete( + folder_id => file_storage.delete_folder.folder_id + ); + end delete_folder; + +end file_storage; +/ +show errors; + +-- JS: BEFORE DELETE TRIGGER to clean up CR +create or replace trigger fs_package_items_delete_trig +before delete on fs_root_folders +for each row +declare + cursor v_cursor is + select item_id,content_type + from cr_items + where item_id != :old.folder_id + connect by parent_id = prior item_id + start with item_id = :old.folder_id + order by level desc; +begin + for v_rec in v_cursor + loop + -- We delete the item. On delete cascade should take care + -- of deletion of revisions. + if v_rec.content_type = 'file_storage_object' + then + content_item.delete(v_rec.item_id); + end if; + + -- Instead of doing an if-else, we make sure we are deleting a folder. + if v_rec.content_type = 'content_folder' + then + content_folder.delete(v_rec.item_id); + end if; + + -- Instead of doing an if-else, we make sure we are deleting a folder. + if v_rec.content_type = 'content_symlink' + then + content_symlink.delete(v_rec.item_id); + end if; + + -- Instead of doing an if-else, we make sure we are deleting a folder. + if v_rec.content_type = 'content_extlink' + then + content_extlink.delete(v_rec.item_id); + end if; + + end loop; +end; +/ +show errors; + +-- JS: AFTER DELETE TRIGGER to clean up last entry in CR +create or replace trigger fs_root_folder_delete_trig +after delete on fs_root_folders +for each row +begin + content_folder.delete(:old.folder_id); +end; +/ +show errors; Index: openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql 17 May 2003 10:38:11 -0000 1.9 +++ openacs-4/packages/file-storage/sql/postgresql/file-storage-package-create.sql 28 Aug 2003 09:41:53 -0000 1.10 @@ -225,7 +225,7 @@ end if; - perform acs_object__update_last_modified(new_file__folder_id); + perform acs_object__update_last_modified(new_file__folder_id,new_file__user_id,new_file__creation_ip); return v_item_id; @@ -392,7 +392,7 @@ end if; - perform acs_object__update_last_modified(copy_file__target_folder_id); + perform acs_object__update_last_modified(copy_file__target_folder_id,copy_file__creation_user,copy_file__creation_ip); return v_new_version_id; @@ -410,14 +410,16 @@ declare move_file__file_id alias for $1; move_file__target_folder_id alias for $2; + move_file__creation_user alias for $3; + move_file__creation_ip alias for $4; begin perform content_item__move( move_file__file_id, -- item_id move_file__target_folder_id -- target_folder_id ); - perform acs_object__update_last_modified(move_file__target_folder_id); + perform acs_object__update_last_modified(move_file__target_folder_id,move_file__creation_user,move_file__creation_ip); return 0; end;' language 'plpgsql'; @@ -554,7 +556,7 @@ from cr_items where cr_items.item_id = new_version__item_id; - perform acs_object__update_last_modified(v_folder_id); + perform acs_object__update_last_modified(v_folder_id,new_version__creation_user,new_version__creation_ip); return v_revision_id; Index: openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.2-4.6.3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.2-4.6.3.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.2-4.6.3.sql 28 Aug 2003 09:41:54 -0000 1.2 @@ -0,0 +1,253 @@ +-- Add user_id and IP to update_last_modified +-- $Id + +create function file_storage__new_file( + -- + -- Create a file in CR in preparation for actual storage + -- Wrapper for content_item__new + -- + -- DRB: I added this version to allow one to predefine item_id, among other things to + -- make it easier to use with ad_form + varchar, -- cr_items.name%TYPE, + integer, -- cr_items.parent_id%TYPE, + integer, -- acs_objects.creation_user%TYPE, + varchar, -- acs_objects.creation_ip%TYPE, + boolean, -- store in db? + integer -- cr_items.item_id%TYPE, +) returns integer as ' -- cr_items.item_id%TYPE +declare + new_file__title alias for $1; + new_file__folder_id alias for $2; + new_file__user_id alias for $3; + new_file__creation_ip alias for $4; + new_file__indb_p alias for $5; + new_file__item_id alias for $6; + v_item_id integer; +begin + + if new_file__indb_p + then + v_item_id := content_item__new ( + new_file__title, -- name + new_file__folder_id, -- parent_id + new_file__item_id, -- item_id (default) + null, -- locale (default) + now(), -- creation_date (default) + new_file__user_id, -- creation_user + new_file__folder_id, -- context_id + new_file__creation_ip, -- creation_ip + ''content_item'', -- item_subtype (default) + ''file_storage_object'', -- content_type (needed by site-wide search) + null, -- title (default) + null, -- description + ''text/plain'', -- mime_type (default) + null, -- nls_language (default) + null -- data (default) + ); + else + v_item_id := content_item__new ( + new_file__title, -- name + new_file__folder_id, -- parent_id + new_file__item_id, -- item_id (default) + null, -- locale (default) + now(), -- creation_date (default) + new_file__user_id, -- creation_user + new_file__folder_id, -- context_id + new_file__creation_ip, -- creation_ip + ''content_item'', -- item_subtype (default) + ''file_storage_object'', -- content_type (needed by site-wide search) + null, -- title (default) + null, -- description + ''text/plain'', -- mime_type (default) + null, -- nls_language (default) + null, -- text (default) + ''file'' -- storage_type + ); + + end if; + + perform acs_object__update_last_modified(new_file__folder_id,new_file__user_id,new_file__creation_ip); + + return v_item_id; + +end;' language 'plpgsql'; + + +create function file_storage__copy_file( + -- + -- Copy a file, but only copy the live_revision + -- + integer, -- cr_items.item_id%TYPE, + integer, -- cr_items.parent_id%TYPE, + integer, -- acs_objects.creation_user%TYPE, + varchar -- acs_objects.creation_ip%TYPE +) returns integer as ' -- cr_revisions.revision_id%TYPE +declare + copy_file__file_id alias for $1; + copy_file__target_folder_id alias for $2; + copy_file__creation_user alias for $3; + copy_file__creation_ip alias for $4; + v_title cr_items.name%TYPE; + v_live_revision cr_items.live_revision%TYPE; + v_filename cr_revisions.title%TYPE; + v_description cr_revisions.description%TYPE; + v_mime_type cr_revisions.mime_type%TYPE; + v_content_length cr_revisions.content_length%TYPE; + v_lob_id cr_revisions.lob%TYPE; + v_new_lob_id cr_revisions.lob%TYPE; + v_file_path cr_revisions.content%TYPE; + v_new_file_id cr_items.item_id%TYPE; + v_new_version_id cr_revisions.revision_id%TYPE; + v_indb_p boolean; +begin + + -- We copy only the title from the file being copied, and attributes of the + -- live revision + select i.name,i.live_revision,r.title,r.description,r.mime_type,r.content_length, + (case when i.storage_type = ''lob'' + then true + else false + end) + into v_title,v_live_revision,v_filename,v_description,v_mime_type,v_content_length,v_indb_p + from cr_items i, cr_revisions r + where r.item_id = i.item_id + and r.revision_id = i.live_revision + and i.item_id = copy_file__file_id; + + -- We should probably use the copy functions of CR + -- when we optimize this function + v_new_file_id := file_storage__new_file( + v_title, -- title + copy_file__target_folder_id, -- folder_id + copy_file__creation_user, -- creation_user + copy_file__creation_ip, -- creation_ip + v_indb_p -- indb_p + ); + + v_new_version_id := file_storage__new_version ( + v_filename, -- title + v_description, -- description + v_mime_type, -- mime_type + v_new_file_id, -- item_id + copy_file__creation_user, -- creation_user + copy_file__creation_ip -- creation_ip + ); + + if v_indb_p + then + + -- Lob to copy from + select lob into v_lob_id + from cr_revisions + where revision_id = v_live_revision; + + -- New lob id + v_new_lob_id := empty_lob(); + + -- copy the blob + perform lob_copy(v_lob_id,v_new_lob_id); + + -- Update the lob id on the new version + update cr_revisions + set lob = v_new_lob_id, + content_length = v_content_length + where revision_id = v_new_version_id; + + else + + -- For now, we simply copy the file name + select content into v_file_path + from cr_revisions + where revision_id = v_live_revision; + + -- Update the file path + update cr_revisions + set content = v_file_path, + content_length = v_content_length + where revision_id = v_new_version_id; + + end if; + + perform acs_object__update_last_modified(copy_file__target_folder_id,copy_file__creation_user,copy_file__creation_ip); + + return v_new_version_id; + +end;' language 'plpgsql'; + + +create function file_storage__move_file ( + -- + -- Move a file (ans all its versions) to a different folder. + -- Wrapper for content_item__move + -- + integer, -- cr_folders.folder_id%TYPE, + integer -- cr_folders.folder_id%TYPE +) returns integer as ' -- 0 for success +declare + move_file__file_id alias for $1; + move_file__target_folder_id alias for $2; + move_file__creation_user alias for $3; + move_file__creation_ip alias for $4; +begin + + perform content_item__move( + move_file__file_id, -- item_id + move_file__target_folder_id -- target_folder_id + ); + + perform acs_object__update_last_modified(move_file__target_folder_id,move_file__creation_user,move_file__creation_ip); + + return 0; +end;' language 'plpgsql'; + +create function file_storage__new_version ( + -- + -- Create a new version of a file + -- Wrapper for content_revision__new + -- + varchar, -- cr_revisions.title%TYPE, + varchar, -- cr_revisions.description%TYPE, + varchar, -- cr_revisions.mime_type%TYPE, + integer, -- cr_items.item_id%TYPE, + integer, -- acs_objects.creation_user%TYPE, + varchar -- acs_objects.creation_ip%TYPE +) returns integer as ' -- cr_revisions.revision_id +declare + new_version__filename alias for $1; + new_version__description alias for $2; + new_version__mime_type alias for $3; + new_version__item_id alias for $4; + new_version__creation_user alias for $5; + new_version__creation_ip alias for $6; + v_revision_id cr_revisions.revision_id%TYPE; + v_folder_id cr_items.parent_id%TYPE; +begin + -- Create a revision + v_revision_id := content_revision__new ( + new_version__filename, -- title + new_version__description, -- description + now(), -- publish_date + new_version__mime_type, -- mime_type + null, -- nls_language + null, -- data (default) + new_version__item_id, -- item_id + null, -- revision_id + now(), -- creation_date + new_version__creation_user, -- creation_user + new_version__creation_ip -- creation_ip + ); + + -- Make live the newly created revision + perform content_item__set_live_revision(v_revision_id); + + select cr_items.parent_id + into v_folder_id + from cr_items + where cr_items.item_id = new_version__item_id; + + perform acs_object__update_last_modified(v_folder_id,new_version__creation_user,new_version__creation_ip); + + return v_revision_id; + +end;' language 'plpgsql'; + Index: openacs-4/packages/file-storage/www/file-move-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-move-2-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/file-storage/www/file-move-2-oracle.xql 25 Sep 2001 16:52:03 -0000 1.2 +++ openacs-4/packages/file-storage/www/file-move-2-oracle.xql 28 Aug 2003 09:41:54 -0000 1.3 @@ -9,7 +9,9 @@ begin file_storage.move_file ( file_id => :file_id, - target_folder_id => :parent_id + target_folder_id => :parent_id, + creation_user => :user_id, + creation_ip => :address ); end; Index: openacs-4/packages/file-storage/www/file-move-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-move-2-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/file-storage/www/file-move-2-postgresql.xql 25 Sep 2001 16:52:16 -0000 1.2 +++ openacs-4/packages/file-storage/www/file-move-2-postgresql.xql 28 Aug 2003 09:41:54 -0000 1.3 @@ -8,7 +8,9 @@ select file_storage__move_file ( :file_id, -- file_id - :parent_id -- target_folder_id + :parent_id, -- target_folder_id + :user_id, -- creation_user + :address -- creation_ip ); Index: openacs-4/packages/file-storage/www/file-move-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-move-2.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/file-storage/www/file-move-2.tcl 5 Nov 2002 17:19:59 -0000 1.7 +++ openacs-4/packages/file-storage/www/file-move-2.tcl 28 Aug 2003 09:41:54 -0000 1.8 @@ -26,13 +26,18 @@ ad_require_permission $file_id write ad_require_permission $parent_id write +set user_id [ad_conn user_id] +set address [ad_conn peeraddr] + db_transaction { db_exec_plsql file_move " begin file_storage.move_file ( file_id => :file_id, - target_folder_id => :parent_id + target_folder_id => :parent_id, + creation_user => :user_id, + creation_ip => :address: ); end;" Index: openacs-4/packages/file-storage/www/file.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file.adp,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/file-storage/www/file.adp 13 Aug 2003 13:30:53 -0000 1.13 +++ openacs-4/packages/file-storage/www/file.adp 28 Aug 2003 09:41:54 -0000 1.14 @@ -38,7 +38,8 @@ - +Back to folder view +

    Index: openacs-4/packages/file-storage/www/file.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/file.tcl,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/file-storage/www/file.tcl 13 Aug 2003 11:14:35 -0000 1.12 +++ openacs-4/packages/file-storage/www/file.tcl 28 Aug 2003 09:41:54 -0000 1.13 @@ -63,11 +63,15 @@ set content_size_pretty [lc_numeric $content_size] } -if { [apm_package_installed_p "general-comments"] && [ad_parameter "GeneralCommentsP" -default 0] } { - set return_url "[ad_conn url]?file_id=$file_id" +set return_url "[ad_conn url]?file_id=$file_id" + +if { [apm_package_installed_p "general-comments"] && [ad_parameter "GeneralCommentsP" -package_id [ad_conn package_id]] } { set gc_link [general_comments_create_link $file_id $return_url] set gc_comments [general_comments_get_comments $file_id $return_url] } else { set gc_link "" set gc_comments "" } + +# get folder id so we can implement a back link +set folder_id [db_string get_folder ""] Index: openacs-4/packages/file-storage/www/file.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/www/file.xql 28 Aug 2003 09:41:54 -0000 1.2 @@ -0,0 +1,11 @@ + + + + + + select content_item.get_parent_folder(:file_id) + from dual + + + + Index: openacs-4/packages/forums/sql/postgresql/forums-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/forums/sql/postgresql/forums-create.sql 1 Jun 2002 19:02:29 -0000 1.1 +++ openacs-4/packages/forums/sql/postgresql/forums-create.sql 28 Aug 2003 09:41:54 -0000 1.2 @@ -22,3 +22,6 @@ -- notifications \i forums-notifications-init.sql + +-- Search +\i forums-sc-create.sql Index: openacs-4/packages/forums/sql/postgresql/forums-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-drop.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/forums/sql/postgresql/forums-drop.sql 12 Jun 2002 15:24:02 -0000 1.1 +++ openacs-4/packages/forums/sql/postgresql/forums-drop.sql 28 Aug 2003 09:41:54 -0000 1.2 @@ -21,3 +21,6 @@ -- The basic forum constructs \i forums-forums-package-drop.sql \i forums-forums-drop.sql + +-- Search +\i forums-sc-drop.sql Index: openacs-4/packages/forums/sql/postgresql/forums-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-sc-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/sql/postgresql/forums-sc-create.sql 28 Aug 2003 09:41:54 -0000 1.2 @@ -0,0 +1,76 @@ +-- forums service contracts for Search package +-- dave bauer +-- August 7, 2002 + +select acs_sc_impl__new( + 'FtsContentProvider', -- impl_contract_name + 'forums_message', -- impl_name + 'forums' -- impl_owner.name +); + +select acs_sc_impl_alias__new( + 'FtsContentProvider', -- impl_contract_name + 'forums_message', -- impl_name + 'datasource', -- impl_operation_name + 'forum::message::datasource', -- impl_alias + 'TCL' -- impl_pl +); + +select acs_sc_impl_alias__new( + 'FtsContentProvider', -- impl_contract_name + 'forums_message', -- impl_name + 'url', -- impl_operation_name + 'forum::message::url', -- impl_alias + 'TCL' -- impl_pl +); + +-- til: only indexing full threads. changes to child messages will be treated as +-- change to the thread. + +create or replace function forums_message_search__itrg () +returns opaque as ' +begin + if new.parent_id is null then + perform search_observer__enqueue(new.message_id,''INSERT''); + else + perform search_observer__enqueue(forums_message__root_message_id(new.parent_id),''UPDATE''); + end if; + return new; +end;' language 'plpgsql'; + +create or replace function forums_message_search__dtrg () +returns opaque as ' +declare + v_root_message_id forums_messages.message_id%TYPE; +begin + -- if the deleted msg has a parent then its an UPDATE to a thread, otherwise a DELETE. + + if old.parent_id is null then + perform search_observer__enqueue(old.message_id,''DELETE''); + else + v_root_message_id := forums_message__root_message_id(old.parent_id); + if not v_root_message_id is null then + perform search_observer__enqueue(v_root_message_id,''UPDATE''); + end if; + end if; + + return old; +end;' language 'plpgsql'; + +create or replace function forums_message_search__utrg () +returns opaque as ' +begin + perform search_observer__enqueue(forums_message__root_message_id (old.message_id),''UPDATE''); + return old; +end;' language 'plpgsql'; + + +create trigger forums_message_search__itrg after insert on forums_messages +for each row execute procedure forums_message_search__itrg (); + +create trigger forums_message_search__dtrg after delete on forums_messages +for each row execute procedure forums_message_search__dtrg (); + +create trigger forums_message_search__utrg after update on forums_messages +for each row execute procedure forums_message_search__utrg (); + Index: openacs-4/packages/forums/sql/postgresql/forums-sc-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-sc-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/sql/postgresql/forums-sc-drop.sql 28 Aug 2003 09:41:54 -0000 1.2 @@ -0,0 +1,23 @@ +-- /packages/news/sql/news-sc-drop.sql +-- +-- @author Robert Locke (rlocke@infiniteinfo.com) +-- @created 2001-10-23 +-- @cvs-id $Id: forums-sc-drop.sql,v 1.2 2003/08/28 09:41:54 lars Exp $ +-- +-- Removes search support from news module. +-- + +select acs_sc_impl__delete( + 'FtsContentProvider', -- impl_contract_name + 'forums_message' -- impl_name +); + + + +drop trigger forums_message_search__itrg on forums_messages; +drop trigger forums_message_search__dtrg on forums_messages; +drop trigger forums_message_search__utrg on forums_messages; + +drop function forums_message_search__itrg (); +drop function forums_message_search__dtrg (); +drop function forums_message_search__utrg (); Index: openacs-4/packages/forums/www/forum-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/forum-view.adp,v diff -u -N -r1.20 -r1.21 --- openacs-4/packages/forums/www/forum-view.adp 22 May 2003 14:56:35 -0000 1.20 +++ openacs-4/packages/forums/www/forum-view.adp 28 Aug 2003 09:41:54 -0000 1.21 @@ -62,7 +62,7 @@ - - + Index: openacs-4/packages/forums/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/index.adp,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/forums/www/index.adp 20 Jun 2003 15:24:24 -0000 1.19 +++ openacs-4/packages/forums/www/index.adp 28 Aug 2003 09:41:54 -0000 1.20 @@ -43,7 +43,7 @@ - - Index: openacs-4/packages/forums/www/message-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/message-chunk.adp,v diff -u -N -r1.17 -r1.18 --- openacs-4/packages/forums/www/message-chunk.adp 20 Jun 2003 15:24:24 -0000 1.17 +++ openacs-4/packages/forums/www/message-chunk.adp 28 Aug 2003 09:41:54 -0000 1.18 @@ -12,9 +12,9 @@ - - + @@ -47,10 +47,10 @@ - - + - + - + - Index: openacs-4/packages/wp-slim/www/create-presentation.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/create-presentation.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/create-presentation.tcl 6 Sep 2002 15:32:23 -0000 1.3 +++ openacs-4/packages/wp-slim/www/create-presentation.tcl 28 Aug 2003 09:42:00 -0000 1.4 @@ -11,6 +11,25 @@ context:onevalue } +set package_id [ad_conn package_id] +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $package_id -privilege wp_create_presentation + +set items [db_list_of_lists wp_styles { *SQL* }] + + set names [list] + set values [list] + foreach image $items { + lappend names [lindex $image 1] + lappend values [lindex $image 0] + } + + lappend names "none" + lappend values -1 + + set available_styles "\n" + set title "Create Presentation" set context [list $title] Index: openacs-4/packages/wp-slim/www/create-presentation.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/create-presentation.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/create-presentation.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,17 @@ + + + + + + + + select style_id, (case when owner = :user_id then name || ' (yours)' else name end) as name + from wp_styles + where owner = :user_id + or public_p = 't' + order by name + + + + + Index: openacs-4/packages/wp-slim/www/delete-presentation-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/delete-presentation-2.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/delete-presentation-2.tcl 18 Sep 2002 12:07:02 -0000 1.2 +++ openacs-4/packages/wp-slim/www/delete-presentation-2.tcl 28 Aug 2003 09:42:00 -0000 1.3 @@ -18,7 +18,7 @@ if { [ad_check_password $user_id $password] } { db_exec_plsql delete_presentation { - begin + begin wp_presentation.delete(:pres_item_id); end; } @@ -27,4 +27,4 @@ ad_script_abort } -ad_returnredirect "" \ No newline at end of file +ad_returnredirect "" Index: openacs-4/packages/wp-slim/www/delete-slide-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/delete-slide-2.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/delete-slide-2.tcl 4 Oct 2001 04:29:01 -0000 1.2 +++ openacs-4/packages/wp-slim/www/delete-slide-2.tcl 28 Aug 2003 09:42:00 -0000 1.3 @@ -12,7 +12,11 @@ pres_item_id:naturalnum,notnull } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_delete_presentation + db_exec_plsql delete_slide { begin wp_slide.delete(:slide_item_id); Index: openacs-4/packages/wp-slim/www/delete-slide.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/delete-slide.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/delete-slide.adp 22 May 2003 15:18:55 -0000 1.4 +++ openacs-4/packages/wp-slim/www/delete-slide.adp 28 Aug 2003 09:42:00 -0000 1.5 @@ -7,11 +7,10 @@ Are you sure that you want to delete this slide?
      -
    • Title: as -
    • Contents: +
    • Title: @slide_title@
    -

    \ No newline at end of file +

    Index: openacs-4/packages/wp-slim/www/delete-slide.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/delete-slide.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/delete-slide.tcl 6 Sep 2002 15:32:23 -0000 1.3 +++ openacs-4/packages/wp-slim/www/delete-slide.tcl 28 Aug 2003 09:42:00 -0000 1.4 @@ -10,9 +10,14 @@ } { slide_item_id:naturalnum,notnull pres_item_id:naturalnum,notnull + slide_title } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_delete_presentation + set context [list "Delete a Slide"] ad_return_template Index: openacs-4/packages/wp-slim/www/edit-presentation-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/edit-presentation-2.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/edit-presentation-2.tcl 10 Sep 2002 22:23:30 -0000 1.5 +++ openacs-4/packages/wp-slim/www/edit-presentation-2.tcl 28 Aug 2003 09:42:00 -0000 1.6 @@ -17,7 +17,10 @@ } +#added permission checking roc@ set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + set creation_ip [ad_conn peeraddr] db_exec_plsql update_wp_presentation { Index: openacs-4/packages/wp-slim/www/edit-presentation-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/edit-presentation-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/edit-presentation-oracle.xql 4 Oct 2001 04:23:13 -0000 1.1 +++ openacs-4/packages/wp-slim/www/edit-presentation-oracle.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -6,7 +6,7 @@ - select p.pres_title, p.page_signature, p.copyright_notice, p.public_p, p.show_modified_p, wp_presentation.get_audience(:pres_item_id) as audience, wp_presentation.get_background(:pres_item_id) as background + select p.pres_title, p.page_signature, p.copyright_notice, p.public_p, p.show_modified_p, wp_presentation.get_audience(:pres_item_id) as audience, wp_presentation.get_background(:pres_item_id) as background, style from cr_wp_presentations p, cr_items i where i.item_id = :pres_item_id and i.live_revision = p.presentation_id @@ -15,4 +15,5 @@ + Index: openacs-4/packages/wp-slim/www/edit-presentation-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/edit-presentation-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/edit-presentation-postgresql.xql 4 Oct 2001 04:23:13 -0000 1.1 +++ openacs-4/packages/wp-slim/www/edit-presentation-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -6,7 +6,7 @@ - select p.pres_title, p.page_signature, p.copyright_notice, p.public_p, + select p.pres_title, p.page_signature, p.copyright_notice, p.public_p, style, p.show_modified_p from cr_wp_presentations p, cr_items i where i.item_id = :pres_item_id @@ -36,5 +36,4 @@ - Index: openacs-4/packages/wp-slim/www/edit-presentation.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/edit-presentation.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/edit-presentation.adp 22 May 2003 15:18:55 -0000 1.4 +++ openacs-4/packages/wp-slim/www/edit-presentation.adp 28 Aug 2003 09:42:00 -0000 1.5 @@ -21,7 +21,7 @@ - - + - + - + - +wp Index: openacs-4/packages/wp-slim/www/serve-presentation-revision.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-presentation-revision.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/serve-presentation-revision.tcl 6 Sep 2002 15:32:23 -0000 1.4 +++ openacs-4/packages/wp-slim/www/serve-presentation-revision.tcl 28 Aug 2003 09:42:00 -0000 1.5 @@ -25,6 +25,10 @@ ad_return_error "Wimpy Point" "Could not get a pres_item_id and a pres_revision_id out of url=$url" } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_view_presentation + set subsite_name [ad_conn package_url] regexp {^(.+)/$} $subsite_name match subsite_name Index: openacs-4/packages/wp-slim/www/serve-presentation-revision.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-presentation-revision.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/serve-presentation-revision.xql 15 Nov 2001 01:47:13 -0000 1.1 +++ openacs-4/packages/wp-slim/www/serve-presentation-revision.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -6,9 +6,9 @@ select p.pres_title, p.page_signature, - p.copyright_notice, p.public_p, - p.show_modified_p + p.show_modified_p , + p.copyright_notice from cr_wp_presentations p, cr_items i where i.item_id = :pres_item_id and p.presentation_id = :pres_revision_id Index: openacs-4/packages/wp-slim/www/serve-presentation.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-presentation.adp,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/wp-slim/www/serve-presentation.adp 22 May 2003 15:18:55 -0000 1.7 +++ openacs-4/packages/wp-slim/www/serve-presentation.adp 28 Aug 2003 09:42:00 -0000 1.8 @@ -1,19 +1,30 @@ @pres_title;noquote@ "one presentation" +@style@ +@page_signature@ +@copyright_notice@
    @@ -59,7 +60,7 @@
    - @version.title@ + @version.title@ @version.author@ @version.content_size_pretty@
    + @@ -74,7 +74,7 @@ (@messages.state@) @messages.user_name@@messages.user_name@ @messages.n_messages@ @messages.last_child_post_pretty@
    + @@ -68,7 +68,7 @@
    + #forums.No_Forums#
    + @message.user_name@@message.posting_date_pretty@@message.posting_date_pretty@
    + - + Index: openacs-4/packages/forums/www/message-email.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-email.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/forums/www/message-email.tcl 20 Jun 2003 15:24:24 -0000 1.7 +++ openacs-4/packages/forums/www/message-email.tcl 28 Aug 2003 09:41:54 -0000 1.8 @@ -44,10 +44,10 @@ # Get the data forum::message::get -message_id $message_id -array message - set new_body "$pre_body" + set new_body "[ad_html_to_text $pre_body]" append new_body "\n\n===================================\n\n" append new_body "[_ forums.On] $message(posting_date), $message(user_name) [_ forums.wrote]\n\n" - append new_body "$message(content)\n" + append new_body "[ad_html_to_text $message(content)]\n" # Send the email acs_mail_lite::send -to_addr $to_email \ Index: openacs-4/packages/forums/www/message-post-confirm.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-post-confirm.adp,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/forums/www/message-post-confirm.adp 22 May 2003 14:56:35 -0000 1.9 +++ openacs-4/packages/forums/www/message-post-confirm.adp 28 Aug 2003 09:41:54 -0000 1.10 @@ -37,7 +37,7 @@
    - + Index: openacs-4/packages/forums/www/message-view-flat.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/message-view-flat.adp,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/forums/www/message-view-flat.adp 22 May 2003 14:56:35 -0000 1.10 +++ openacs-4/packages/forums/www/message-view-flat.adp 28 Aug 2003 09:41:54 -0000 1.11 @@ -6,6 +6,14 @@ + + + + Index: openacs-4/packages/forums/www/message-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view.adp,v diff -u -N -r1.15 -r1.16 --- openacs-4/packages/forums/www/message-view.adp 22 May 2003 14:56:35 -0000 1.15 +++ openacs-4/packages/forums/www/message-view.adp 28 Aug 2003 09:41:54 -0000 1.16 @@ -9,6 +9,14 @@
    + Back to @forum.name@ + +   +
    @notification_chunk;noquote@
    + + + + -
    + Back to @forum.name@ + +   +
    @notification_chunk;noquote@ @@ -39,7 +47,7 @@ <% set width [expr 100 - [expr $responses(tree_level) - 1] * 3] %>
    + Index: openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql 8 Feb 2003 02:18:01 -0000 1.2 +++ openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql 28 Aug 2003 09:41:54 -0000 1.3 @@ -20,6 +20,7 @@ where g.object_id = :object_id and r.revision_id = content_item__get_live_revision(g.comment_id) and o.object_id = g.comment_id + $context_clause order by o.creation_date Index: openacs-4/packages/general-comments/tcl/general-comments-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 8 Feb 2003 02:18:01 -0000 1.8 +++ openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 28 Aug 2003 09:41:54 -0000 1.9 @@ -18,6 +18,7 @@ ad_proc -public general_comments_get_comments { { -print_content_p 0 } { -print_attachments_p 0 } + {-context_id ""} object_id {return_url {}} } { @@ -26,6 +27,7 @@ @param print_content_p Pass in 1 to print out content of comments. @param print_attachments_p Pass in 1 to print out attachments of comments, only works if print_content_p is 1. + @param context_id Show only comments with given context_id @param object_id The object_id to retrieve the comments for. @param return_url A url for the user to return to after viewing a comment. } { @@ -44,24 +46,15 @@ set content_select [db_map content_select] ;# ", r.content" } # ns_log notice "content_select: $content_select" + + if { ![empty_string_p $context_id] } { + set context_clause "and o.context_id = :context_id" + } else { + set context_clause "" + } set html "" - db_foreach get_comments " - select g.comment_id, - r.title, - r.mime_type, - o.creation_user, - acs_object.name(o.creation_user) as author, - to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date, - to_char(o.creation_date, 'Month DD, YYYY HH12:MI PM') as pretty_date2 - $content_select - from general_comments g, - cr_revisions r, - acs_objects o - where g.object_id = :object_id and - r.revision_id = content_item.get_live_revision(g.comment_id) and - o.object_id = g.comment_id - order by o.creation_date" { + db_foreach get_comments {} { # call on helper proc to print out comment append html [general_comments_print_comment $comment_id $title $mime_type \ $creation_user $author $pretty_date $pretty_date2 $content \ @@ -136,8 +129,6 @@ } if { ![empty_string_p $attachments_html] } { append html "
    [_ general-comments.Attachments]
    \n
      \n$attachments_html
    \n" - } else { - append html "

    " } } append html "

    -- $author [_ general-comments.on] $pretty_date2 ([_ general-comments.view_details])

    \n" Index: openacs-4/packages/lars-blogger/lars-blogger.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/lars-blogger.info,v diff -u -N -r1.14 -r1.15 --- openacs-4/packages/lars-blogger/lars-blogger.info 30 Jan 2003 16:54:44 -0000 1.14 +++ openacs-4/packages/lars-blogger/lars-blogger.info 28 Aug 2003 09:41:54 -0000 1.15 @@ -2,128 +2,43 @@ - Lars Blogger - Lars Bloggers + Weblogger + Webloggers f f - - - - oracle - postgresql - + + Lars Pind + Simon Carstensen Write your own web log - 2003-01-30 + 2003-06-10 Collaboraid - Manages multiple web logs for your site. Just mount multiple instances, and you can do all the blogging you want. + Manages multiple weblogs for your wbsite. - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + Index: openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-create.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-create.sql 27 Jan 2003 16:17:55 -0000 1.3 +++ openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-create.sql 28 Aug 2003 09:41:54 -0000 1.4 @@ -33,6 +33,7 @@ package_id constraint pinds_blog_entry_package_id_fk references apm_packages(package_id), title varchar(500), + title_url varchar(500), content clob, content_format varchar(50) default 'text/html' @@ -48,7 +49,37 @@ check (deleted_p in ('t','f')) ); +declare +begin + acs_object_type.create_type( + object_type => 'weblogger_channel', + pretty_name => 'Weblogger Channel', + pretty_plural => 'Weblogger Channels', + supertype => 'acs_object', + table_name => 'weblogger_channel', + id_column => 'channel_id', + package_name => null, + abstract_p => 'f', + type_extension_table => null, + name_method => null + ); +end; +/ +show errors +create table weblogger_channels ( + channel_id constraint weblogger_channels_cid_fk + references acs_objects(object_id) + constraint weblogger_channels_cid_pk + primary key, + package_id constraint weblogger_channels_pid_kf + references apm_packages(package_id), + user_id integer, + constraint weblogger_chnls_pck_user_un + unique (package_id, user_id) +); + + @@ lars-blogger-package-create @@ rss-register @@ notifications-init Index: openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-drop.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-drop.sql 14 Sep 2002 21:43:33 -0000 1.2 +++ openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-drop.sql 28 Aug 2003 09:41:54 -0000 1.3 @@ -12,7 +12,15 @@ @@ rss-unregister begin + acs_object_type.drop_type('weblogger_channel', 't'); +end; +/ +show errors +drop table weblogger_channels; + +begin + for blog_entry in (select entry_id from pinds_blog_entries) loop -- delete comments (which are acs_message's) for comment in (select comment_id from general_comments @@ -23,15 +31,13 @@ pinds_blog_entry.delete(blog_entry.entry_id); end loop; - acs_object_type.drop_type( - object_type => 'pinds_blog_entry', - cascade_p => 't' - ); + acs_object_type.drop_type('pinds_blog_entry', 't'); end; / show errors + @@ lars-blogger-package-drop drop table pinds_blog_entries; Index: openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-create.sql 27 Jan 2003 16:17:55 -0000 1.2 +++ openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-create.sql 28 Aug 2003 09:41:54 -0000 1.3 @@ -14,6 +14,7 @@ entry_id in pinds_blog_entries.entry_id%TYPE default null, package_id in pinds_blog_entries.package_id%TYPE, title in pinds_blog_entries.title%TYPE default null, + title_url in pinds_blog_entries.title_url%TYPE default null, content in varchar default null, content_format in varchar default 'text/html', entry_date in pinds_blog_entries.entry_date%TYPE default null, @@ -41,6 +42,7 @@ entry_id in pinds_blog_entries.entry_id%TYPE default null, package_id in pinds_blog_entries.package_id%TYPE, title in pinds_blog_entries.title%TYPE default null, + title_url in pinds_blog_entries.title_url%TYPE default null, content in varchar default null, content_format in varchar default 'text/html', entry_date in pinds_blog_entries.entry_date%TYPE default null, @@ -65,6 +67,7 @@ entry_id, package_id, title, + title_url, content, content_format, entry_date, @@ -75,6 +78,7 @@ v_entry_id, pinds_blog_entry.new.package_id, pinds_blog_entry.new.title, + pinds_blog_entry.new.title_url, pinds_blog_entry.new.content, pinds_blog_entry.new.content_format, pinds_blog_entry.new.entry_date, @@ -123,3 +127,78 @@ end pinds_blog_entry; / show errors + +create or replace package weblogger_channel +as + + function new ( + channel_id in weblogger_channels.channel_id%TYPE default null, + package_id in weblogger_channels.package_id%TYPE, + user_id in weblogger_channels.user_id%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return weblogger_channels.channel_id%TYPE; + + procedure delete ( + channel_id in weblogger_channels.channel_id%TYPE + ); + +end weblogger_channel; +/ +show errors + + +create or replace package body weblogger_channel +as + + function new ( + channel_id in weblogger_channels.channel_id%TYPE default null, + package_id in weblogger_channels.package_id%TYPE, + user_id in weblogger_channels.user_id%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return weblogger_channels.channel_id%TYPE + is + v_channel_id weblogger_channels.channel_id%TYPE; + begin + + v_channel_id := acs_object.new( + object_id => weblogger_channel.new.channel_id, + object_type => 'weblogger_channel', + creation_date => sysdate, + creation_user => weblogger_channel.new.creation_user, + creation_ip => weblogger_channel.new.creation_ip, + context_id => weblogger_channel.new.package_id + ); + + insert into weblogger_channels ( + channel_id, + package_id, + user_id + ) values ( + v_channel_id, + weblogger_channel.new.package_id, + weblogger_channel.new.user_id + ); + + return v_channel_id; + + end new; + + procedure delete ( + channel_id in weblogger_channels.channel_id%TYPE + ) + is + begin + + delete + from weblogger_channels + where channel_id = weblogger_channel.delete.channel_id; + + acs_object.delete(weblogger_channel.delete.channel_id); + + end delete; + +end weblogger_channel; +/ +show errors Index: openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-drop.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-drop.sql 19 Aug 2002 21:52:59 -0000 1.1 +++ openacs-4/packages/lars-blogger/sql/oracle/lars-blogger-package-drop.sql 28 Aug 2003 09:41:54 -0000 1.2 @@ -7,5 +7,9 @@ -- @cvs-id $Id$ -- + +drop package body weblogger_channel; +drop package weblogger_channel; + drop package body pinds_blog_entry; drop package pinds_blog_entry; Index: openacs-4/packages/lars-blogger/sql/oracle/notifications-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/notifications-drop.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/sql/oracle/notifications-drop.sql 14 Sep 2002 21:43:33 -0000 1.1 +++ openacs-4/packages/lars-blogger/sql/oracle/notifications-drop.sql 28 Aug 2003 09:41:54 -0000 1.2 @@ -17,3 +17,5 @@ notification_type.delete(row.type_id); end loop; end; +/ +show errors Index: openacs-4/packages/lars-blogger/sql/oracle/rss-register.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/rss-register.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/sql/oracle/rss-register.sql 30 Jan 2003 16:55:03 -0000 1.2 +++ openacs-4/packages/lars-blogger/sql/oracle/rss-register.sql 28 Aug 2003 09:41:54 -0000 1.3 @@ -36,7 +36,7 @@ acs_sc_binding.new ( contract_name => 'RssGenerationSubscriber', impl_name => 'pinds_blog_entries' - ); + ); end; / Index: openacs-4/packages/lars-blogger/sql/oracle/upgrade/upgrade-0.8.4-0.8.5.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/upgrade/upgrade-0.8.4-0.8.5.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/sql/oracle/upgrade/upgrade-0.8.4-0.8.5.sql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,134 @@ +-- +-- Upgrade script +-- +-- Adds the title_url column to blog entries and __new function +-- +-- @author Lars Pind (lars@pinds.com) +-- @creation-date 2003-03-13 +-- + +alter table pinds_blog_entries add ( + title_url varchar(500) +); + + +create or replace package pinds_blog_entry +as + + function new ( + entry_id in pinds_blog_entries.entry_id%TYPE default null, + package_id in pinds_blog_entries.package_id%TYPE, + title in pinds_blog_entries.title%TYPE default null, + title_url in pinds_blog_entries.title_url%TYPE default null, + content in varchar default null, + content_format in varchar default 'text/html', + entry_date in pinds_blog_entries.entry_date%TYPE default null, + draft_p in pinds_blog_entries.draft_p%TYPE default 'f', + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return pinds_blog_entries.entry_id%TYPE; + + procedure delete ( + entry_id in pinds_blog_entries.entry_id%TYPE + ); + + function title ( + entry_id in pinds_blog_entries.entry_id%TYPE + ) return pinds_blog_entries.title%TYPE; + +end pinds_blog_entry; +/ +show errors + +create or replace package body pinds_blog_entry +as + + function new ( + entry_id in pinds_blog_entries.entry_id%TYPE default null, + package_id in pinds_blog_entries.package_id%TYPE, + title in pinds_blog_entries.title%TYPE default null, + title_url in pinds_blog_entries.title_url%TYPE default null, + content in varchar default null, + content_format in varchar default 'text/html', + entry_date in pinds_blog_entries.entry_date%TYPE default null, + draft_p in pinds_blog_entries.draft_p%TYPE default 'f', + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return pinds_blog_entries.entry_id%TYPE + is + v_entry_id pinds_blog_entries.entry_id%TYPE; + begin + + v_entry_id := acs_object.new( + object_id => pinds_blog_entry.new.entry_id, + object_type => 'pinds_blog_entry', + creation_date => sysdate, + creation_user => pinds_blog_entry.new.creation_user, + creation_ip => pinds_blog_entry.new.creation_ip, + context_id => pinds_blog_entry.new.package_id + ); + + insert into pinds_blog_entries ( + entry_id, + package_id, + title, + title_url, + content, + content_format, + entry_date, + posted_date, + draft_p, + deleted_p + ) values ( + v_entry_id, + pinds_blog_entry.new.package_id, + pinds_blog_entry.new.title, + pinds_blog_entry.new.title_url, + pinds_blog_entry.new.content, + pinds_blog_entry.new.content_format, + pinds_blog_entry.new.entry_date, + sysdate, + pinds_blog_entry.new.draft_p, + 'f' + ); + + return v_entry_id; + + end new; + + procedure delete ( + entry_id in pinds_blog_entries.entry_id%TYPE + ) + is + begin + + delete + from pinds_blog_entries + where entry_id = pinds_blog_entry.delete.entry_id; + + acs_object.delete(pinds_blog_entry.delete.entry_id); + + end delete; + + function title ( + entry_id in pinds_blog_entries.entry_id%TYPE + ) return pinds_blog_entries.title%TYPE + is + v_title pinds_blog_entries.title%TYPE; + begin + + select title + into v_title + from pinds_blog_entries + where entry_id = pinds_blog_entry.title.entry_id; + + return v_title; + + exception when no_data_found then + return ''; + + end title; + +end pinds_blog_entry; +/ +show errors Index: openacs-4/packages/lars-blogger/sql/oracle/upgrade/upgrade-0.8.5-0.9.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/oracle/upgrade/Attic/upgrade-0.8.5-0.9.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/sql/oracle/upgrade/upgrade-0.8.5-0.9.sql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,132 @@ +-- +-- Upgrade script +-- +-- @author Simon Carstensen (simon@collaboraid.biz) +-- @creation-date 2003-06-13 +-- + +declare +begin + acs_object_type.create_type( + object_type => 'weblogger_channel', + pretty_name => 'Weblogger Channel', + pretty_plural => 'Weblogger Channels', + supertype => 'acs_object', + table_name => 'weblogger_channel', + id_column => 'channel_id', + package_name => null, + abstract_p => 'f', + type_extension_table => null, + name_method => 'weblogger_channel.name' + ); +end; +/ +show errors + +create table weblogger_channels ( + channel_id constraint weblogger_channels_cid_fk + references acs_objects(object_id) + constraint weblogger_channels_cid_pk + primary key, + package_id constraint weblogger_channels_pid_kf + references apm_packages(package_id), + user_id integer +); + +create or replace package weblogger_channel +as + + function new ( + channel_id in weblogger_channels.channel_id%TYPE default null, + package_id in weblogger_channels.package_id%TYPE, + user_id in weblogger_channels.user_id%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return weblogger_channels.channel_id%TYPE; + + procedure delete ( + channel_id in weblogger_channels.channel_id%TYPE + ); + +end weblogger_channel; +/ +show errors + + +create or replace package body weblogger_channel +as + + function new ( + channel_id in weblogger_channels.channel_id%TYPE default null, + package_id in weblogger_channels.package_id%TYPE, + user_id in weblogger_channels.user_id%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return weblogger_channels.channel_id%TYPE + is + v_channel_id weblogger_channels.channel_id%TYPE; + begin + + v_channel_id := acs_object.new( + object_id => weblogger_channel.new.channel_id, + object_type => 'weblogger_channel', + creation_date => sysdate, + creation_user => weblogger_channel.new.creation_user, + creation_ip => weblogger_channel.new.creation_ip, + context_id => weblogger_channel.new.package_id + ); + + insert into weblogger_channels ( + channel_id, + package_id, + user_id + ) values ( + v_channel_id, + weblogger_channel.new.package_id, + weblogger_channel.new.user_id + ); + + return v_channel_id; + + end new; + + procedure delete ( + channel_id in weblogger_channels.channel_id%TYPE + ) + is + begin + + delete + from weblogger_channels + where channel_id = weblogger_channel.delete.channel_id; + + acs_object.delete(weblogger_channel.delete.channel_id); + + end delete; + +end weblogger_channel; +/ +show errors + +-- Remove the new parameter rss_file_name and update the old one +-- We do this since the APM does not know that the old parameter +-- has been replaced and we want to retain the values of the old parameter +declare + v_parameter_id integer; +begin + + select parameter_id into v_parameter_id + from apm_parameters + where parameter_name = 'rss_file_name'; + + apm.unregister_parameter(v_parameter_id); + +end; +/ +show errors + +update apm_parameters + set parameter_name = 'rss_file_name', + description = 'What name should we advertise the RSS feed under, relative to the blog mount point. Leave blank if no RSS feed.', + default_value = 'rss.xml' + where parameter_name = 'rss_file_url'; Index: openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql 27 Jan 2003 16:18:25 -0000 1.5 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql 28 Aug 2003 09:41:55 -0000 1.6 @@ -29,13 +29,14 @@ constraint pinds_blog_entry_package_id_kf references apm_packages(package_id), title varchar(500), + title_url varchar(500), content varchar(32000), content_format varchar(50) default 'text/html' constraint pinds_blog_entr_cnt_format_nn not null, - entry_date timestamp, - posted_date timestamp, + entry_date timestamptz, + posted_date timestamptz, draft_p char(1) default 'f' constraint pinds_blog_entries_draft_ck check (draft_p in ('t','f')), @@ -61,26 +62,28 @@ create or replace function pinds_blog_entry__new ( - integer, -- entry_id - integer, -- package_id - varchar, -- title - varchar, -- content - varchar, -- content_format - timestamp, -- entry_date - char, -- draft_p - integer, -- creation_user - varchar -- creation_ip + integer, -- entry_id + integer, -- package_id + varchar, -- title + varchar, -- title_url + varchar, -- content + varchar, -- content_format + timestamptz, -- entry_date + char, -- draft_p + integer, -- creation_user + varchar -- creation_ip ) returns integer as ' declare p_entry_id alias for $1; p_package_id alias for $2; p_title alias for $3; - p_content alias for $4; - p_content_format alias for $5; - p_entry_date alias for $6; - p_draft_p alias for $7; - p_creation_user alias for $8; - p_creation_ip alias for $9; + p_title_url alias for $4; + p_content alias for $5; + p_content_format alias for $6; + p_entry_date alias for $7; + p_draft_p alias for $8; + p_creation_user alias for $9; + p_creation_ip alias for $10; v_entry_id integer; begin v_entry_id := acs_object__new ( @@ -96,6 +99,7 @@ entry_id, package_id, title, + title_url, content, content_format, entry_date, @@ -106,6 +110,7 @@ v_entry_id, p_package_id, p_title, + p_title_url, p_content, p_content_format, p_entry_date, @@ -114,6 +119,12 @@ ''f'' ); + PERFORM acs_permission__grant_permission( + v_entry_id, + p_creation_user, + ''admin'' + ); + return v_entry_id; end; ' language 'plpgsql'; @@ -132,5 +143,84 @@ ' language 'plpgsql'; +select acs_object_type__create_type ( + 'weblogger_channel', -- object_type + 'Weblogger Channel', -- pretty_name + 'Weblogger Channels', -- pretty_plural + 'acs_object', -- supertype + 'weblogger_channels', -- table_name + 'channel_id', -- id_column + null, -- package_name + 'f', -- abstract_p + null, -- type_extension_table + null -- name_method +); + +create table weblogger_channels ( + channel_id integer + constraint channel_id_fk + references acs_objects(object_id) + constraint weblogger_channels_pk + primary key, + package_id integer + constraint weblogger_channels_package_id_kf + references apm_packages(package_id), + user_id integer, + constraint weblogger_chnls_package_user_un + unique (package_id, user_id) +); + + + +create or replace function weblogger_channel__new ( + integer, -- channel_id + integer, -- package_id + integer, -- user_id + integer, -- creation_user + varchar -- creation_ip +) returns integer as ' +declare + p_channel_id alias for $1; + p_package_id alias for $2; + p_user_id alias for $3; + p_creation_user alias for $4; + p_creation_ip alias for $5; + v_channel_id integer; +begin + v_channel_id := acs_object__new ( + p_channel_id, + ''weblogger_channel'', + current_timestamp, + p_creation_user, + p_creation_ip, + p_package_id + ); + + insert into weblogger_channels ( + channel_id, + package_id, + user_id + ) values ( + v_channel_id, + p_package_id, + p_user_id + ); + + return v_channel_id; +end; +' language 'plpgsql'; + +create or replace function weblogger_channel__delete (integer) +returns integer as ' +declare + p_channel_id alias for $1; +begin + delete from weblogger_channels + where channel_id = p_channel_id; + PERFORM acs_object__delete(p_channel_id); + return 0; +end; +' language 'plpgsql'; + \i rss-register.sql \i notifications-init.sql Index: openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-drop.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-drop.sql 21 Dec 2002 22:27:58 -0000 1.3 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-drop.sql 28 Aug 2003 09:41:55 -0000 1.4 @@ -34,17 +34,31 @@ select inline_0(); drop function inline_0(); +drop function weblogger_channel__new( + integer, -- channel_id + integer, -- package_id + integer, -- user_id + integer, -- creation_user + varchar -- creation_ip +); +drop function weblogger_channel__delete (integer); + +drop table weblogger_channels; +select acs_object_type__drop_type ('weblogger_channel', true); + drop function pinds_blog_entry__title (integer); drop function pinds_blog_entry__new( - integer, -- entry_id - integer, -- package_id - varchar, -- title - varchar, -- content - timestamp, -- entry_date - char, -- draft_p - integer, -- creation_user - varchar -- creation_ip + integer, -- entry_id + integer, -- package_id + varchar, -- title + varchar, -- title_url + varchar, -- content + varchar, -- content_format + timestamptz, -- entry_date + char, -- draft_p + integer, -- creation_user + varchar -- creation_ip ); drop function pinds_blog_entry__delete (integer); Index: openacs-4/packages/lars-blogger/sql/postgresql/rss-register.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/rss-register.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/sql/postgresql/rss-register.sql 30 Jan 2003 16:55:50 -0000 1.2 +++ openacs-4/packages/lars-blogger/sql/postgresql/rss-register.sql 28 Aug 2003 09:41:55 -0000 1.3 @@ -6,45 +6,29 @@ -- @cvs-id $Id$ -- -create function inline_0() returns integer as ' -declare - impl_id integer; - v_foo integer; -begin - -- the notification type impl - impl_id := acs_sc_impl__new( - ''RssGenerationSubscriber'', -- impl_contract_name - ''pinds_blog_entries'', -- impl_name - ''lars-blogger'' -- impl_owner_name - ); +select acs_sc_impl__new( + 'RssGenerationSubscriber', -- impl_contract_name + 'pinds_blog_entries', -- impl_name + 'lars-blogger' -- impl_owner_name +); - v_foo := acs_sc_impl_alias__new( - ''RssGenerationSubscriber'', -- impl_contract_name - ''pinds_blog_entries'', -- impl_name - ''datasource'', -- impl_operation_name - ''lars_blog__rss_datasource'', -- impl_alias - ''TCL'' -- impl_pl - ); +select acs_sc_impl_alias__new( + 'RssGenerationSubscriber', -- impl_contract_name + 'pinds_blog_entries', -- impl_name + 'datasource', -- impl_operation_name + 'lars_blog__rss_datasource', -- impl_alias + 'TCL' -- impl_pl +); - v_foo := acs_sc_impl_alias__new( - ''RssGenerationSubscriber'', -- impl_contract_name - ''pinds_blog_entries'', -- impl_name - ''lastUpdated'', -- impl_operation_name - ''lars_blog__rss_lastUpdated'', -- impl_alias - ''TCL'' -- impl_pl - ); +select acs_sc_impl_alias__new( + 'RssGenerationSubscriber', -- impl_contract_name + 'pinds_blog_entries', -- impl_name + 'lastUpdated', -- impl_operation_name + 'lars_blog__rss_lastUpdated', -- impl_alias + 'TCL' -- impl_pl +); - PERFORM acs_sc_binding__new ( - ''RssGenerationSubscriber'', - ''pinds_blog_entries'' - ); - - return (0); -end; -' language 'plpgsql'; - -select inline_0(); -drop function inline_0(); - - - +select acs_sc_binding__new ( + 'RssGenerationSubscriber', -- contract_name + 'pinds_blog_entries' -- impl_name +); Index: openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.8.4-0.8.5.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.8.4-0.8.5.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.8.4-0.8.5.sql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,74 @@ +-- +-- Upgrade script +-- +-- Adds the title_url column to blog entries and __new function +-- +-- @author Lars Pind (lars@pinds.com) +-- @creation-date 2003-03-13 +-- + +alter table pinds_blog_entries add + title_url varchar(500); + +create or replace function pinds_blog_entry__new ( + integer, -- entry_id + integer, -- package_id + varchar, -- title + varchar, -- title_url + varchar, -- content + varchar, -- content_format + timestamptz, -- entry_date + char, -- draft_p + integer, -- creation_user + varchar -- creation_ip +) returns integer as ' +declare + p_entry_id alias for $1; + p_package_id alias for $2; + p_title alias for $3; + p_title_url alias for $4; + p_content alias for $5; + p_content_format alias for $6; + p_entry_date alias for $7; + p_draft_p alias for $8; + p_creation_user alias for $9; + p_creation_ip alias for $10; + v_entry_id integer; +begin + v_entry_id := acs_object__new ( + p_entry_id, + ''pinds_blog_entry'', + current_timestamp, + p_creation_user, + p_creation_ip, + p_package_id + ); + + insert into pinds_blog_entries ( + entry_id, + package_id, + title, + title_url, + content, + content_format, + entry_date, + posted_date, + draft_p, + deleted_p + ) values ( + v_entry_id, + p_package_id, + p_title, + p_title_url, + p_content, + p_content_format, + p_entry_date, + current_timestamp, + p_draft_p, + ''f'' + ); + + return v_entry_id; +end; +' language 'plpgsql'; + Index: openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.8.5-0.9.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/upgrade/Attic/upgrade-0.8.5-0.9.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.8.5-0.9.sql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,177 @@ +-- +-- Upgrade script +-- +-- @author Simon Carstensen (simon@collaboraid.biz) +-- @creation-date 2003-06-13 +-- + +create or replace function pinds_blog_entry__new ( + integer, -- entry_id + integer, -- package_id + varchar, -- title + varchar, -- title_url + varchar, -- content + varchar, -- content_format + timestamptz, -- entry_date + char, -- draft_p + integer, -- creation_user + varchar -- creation_ip +) returns integer as ' +declare + p_entry_id alias for $1; + p_package_id alias for $2; + p_title alias for $3; + p_title_url alias for $4; + p_content alias for $5; + p_content_format alias for $6; + p_entry_date alias for $7; + p_draft_p alias for $8; + p_creation_user alias for $9; + p_creation_ip alias for $10; + v_entry_id integer; +begin + v_entry_id := acs_object__new ( + p_entry_id, + ''pinds_blog_entry'', + current_timestamp, + p_creation_user, + p_creation_ip, + p_package_id + ); + + insert into pinds_blog_entries ( + entry_id, + package_id, + title, + title_url, + content, + content_format, + entry_date, + posted_date, + draft_p, + deleted_p + ) values ( + v_entry_id, + p_package_id, + p_title, + p_title_url, + p_content, + p_content_format, + p_entry_date, + current_timestamp, + p_draft_p, + ''f'' + ); + + PERFORM acs_permission__grant_permission( + v_entry_id, + p_creation_user, + ''admin'' + ); + + return v_entry_id; +end; +' language 'plpgsql'; + +select acs_object_type__create_type ( + 'weblogger_channel', -- object_type + 'Weblogger Channel', -- pretty_name + 'Weblogger Channels', -- pretty_plural + 'acs_object', -- supertype + 'weblogger_channels', -- table_name + 'channel_id', -- id_column + null, -- package_name + 'f', -- abstract_p + null, -- type_extension_table + 'weblogger_channels.name' -- name_method +); + +create table weblogger_channels ( + channel_id integer + constraint channel_id_fk + references acs_objects(object_id) + constraint weblogger_channels_pk + primary key, + package_id integer + constraint weblogger_channels_package_id_kf + references apm_packages(package_id), + user_id integer +); + + + +create or replace function weblogger_channel__new ( + integer, -- channel_id + integer, -- package_id + integer, -- user_id + integer, -- creation_user + varchar -- creation_ip +) returns integer as ' +declare + p_channel_id alias for $1; + p_package_id alias for $2; + p_user_id alias for $3; + p_creation_user alias for $4; + p_creation_ip alias for $5; + v_channel_id integer; +begin + v_channel_id := acs_object__new ( + p_channel_id, + ''weblogger_channel'', + current_timestamp, + p_creation_user, + p_creation_ip, + p_package_id + ); + + insert into weblogger_channels ( + channel_id, + package_id, + user_id + ) values ( + v_channel_id, + p_package_id, + p_user_id + ); + + return v_channel_id; +end; +' language 'plpgsql'; + +create or replace function weblogger_channel__delete (integer) +returns integer as ' +declare + p_channel_id alias for $1; +begin + delete from weblogger_channels + where channel_id = p_channel_id; + PERFORM acs_object__delete(p_channel_id); + return 0; +end; +' language 'plpgsql'; + +-- Remove the new parameter rss_file_name and update the old one +-- We do this since the APM does not know that the old parameter +-- has been replaced and we want to retain the values of the old parameter +create function inline_0 () +returns integer as ' +declare + v_parameter_id integer; +begin + select parameter_id into v_parameter_id + from apm_parameters + where parameter_name = ''rss_file_name''; + + perform apm__unregister_parameter(v_parameter_id); + + return 0; +end; +' language 'plpgsql'; +select inline_0 (); +drop function inline_0 (); + +update apm_parameters + set parameter_name = 'rss_file_name', + description = 'What name should we advertise the RSS feed under, relative to the blog mount point. Leave blank if no RSS feed.', + default_value = 'rss.xml' + where parameter_name = 'rss_file_url'; Index: openacs-4/packages/lars-blogger/tcl/entry-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/entry-procs-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/tcl/entry-procs-oracle.xql 27 Jan 2003 16:19:15 -0000 1.1 +++ openacs-4/packages/lars-blogger/tcl/entry-procs-oracle.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -5,29 +5,40 @@ - select entry_id, - to_char(entry_date, 'fmDayfm, Month fmDDfm, YYYY') as entry_date_pretty, - to_char(entry_date, 'YYYY/MM/DD/') as entry_archive_url, - entry_date, - title, - content, - content_format, - draft_p, - 'f' as new_date_p, - p.first_names as poster_first_names, + select b.entry_id, + b.title, + b.title_url, + b.content, + b.content_format, + b.draft_p, + o.creation_user as user_id, + to_char(b.entry_date, 'YYYY-MM-DD') as entry_date, + to_char(b.entry_date, 'fmDayfm, fmMonthfm fmDDfm, YYYY') as entry_date_pretty, + p.first_names as poster_first_names, p.last_name as poster_last_name, - to_char(posted_date , 'HH24:MI') as posted_time_pretty, + to_char(b.posted_date , 'HH24:MI') as posted_time_pretty, + b.package_id, (select count(gc.comment_id) from general_comments gc, cr_revisions cr where gc.object_id = entry_id - and content_item.get_live_revision(gc.comment_id) = cr.revision_id) as num_comments - from pinds_blog_entries e, - acs_objects o, - persons p - where e.entry_id = :entry_id - and o.object_id = e.entry_id - and p.person_id = o.creation_user + and content_item.get_live_revision(gc.comment_id) = cr.revision_id) as num_comments + from pinds_blog_entries b, + acs_objects o, + persons p + where b.entry_id = :entry_id + and o.object_id = b.entry_id + and p.person_id = o.creation_user + + + update pinds_blog_entries + set entry_date = trunc(sysdate), + draft_p = 'f', + posted_date = sysdate + where entry_id = :entry_id + + + Index: openacs-4/packages/lars-blogger/tcl/entry-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/entry-procs-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/tcl/entry-procs-postgresql.xql 27 Jan 2003 16:19:15 -0000 1.1 +++ openacs-4/packages/lars-blogger/tcl/entry-procs-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -7,11 +7,13 @@ select b.entry_id, b.title, + b.title_url, b.content, b.content_format, b.draft_p, + o.creation_user as user_id, to_char(b.entry_date, 'YYYY-MM-DD') as entry_date, - to_char(b.entry_date, 'fmDayfm, Month fmDDfm, YYYY') as entry_date_pretty, + to_char(b.entry_date, 'fmDayfm, fmMonthfm fmDDfm, YYYY') as entry_date_pretty, p.first_names as poster_first_names, p.last_name as poster_last_name, to_char(b.posted_date , 'HH24:MI') as posted_time_pretty, @@ -29,4 +31,14 @@ + + + update pinds_blog_entries + set entry_date = date_trunc('day', current_timestamp), + draft_p = 'f', + posted_date = current_timestamp + where entry_id = :entry_id + + + Index: openacs-4/packages/lars-blogger/tcl/entry-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/entry-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/tcl/entry-procs.tcl 27 Jan 2003 16:19:15 -0000 1.2 +++ openacs-4/packages/lars-blogger/tcl/entry-procs.tcl 28 Aug 2003 09:41:55 -0000 1.3 @@ -2,7 +2,6 @@ Entry procs for blogger. } - namespace eval lars_blogger::entry {} ad_proc -public lars_blogger::entry::get { @@ -12,13 +11,93 @@ # Select the info into the upvar'ed Tcl Array upvar $array row - db_1row select_entry { *SQL* } -column_array row + db_1row select_entry {} -column_array row } +ad_proc -public lars_blogger::entry::require_write_permission { + {-entry_id:required} +} { + permission::require_permission -object_id $entry_id -privilege write + + set admin_p [permission::permission_p -privilege "admin" -object_id $entry_id] + + if { !$admin_p && [ad_conn user_id] != [db_string creation_user {}] } { + ad_return_forbidden "Security Violation" "
    + You don't have permission to modify this entry. +
    + This incident has been logged. +
    " + ad_script_abort + } +} -ad_proc -public do_notifications { +ad_proc -public lars_blogger::entry::publish { {-entry_id:required} + {-package_id ""} + {-no_update:boolean} + {-redirect_url ""} } { + if { !$no_update_p } { + # Set draft_p = 'f' + db_dml update_entry { *SQL* } + # Flush cache + lars_blog_flush_cache + } + + if { ![empty_string_p $redirect_url] } { + ad_returnredirect $redirect_url + ns_conn close + } + + # Setup instance feed if needed + lars_blog_setup_feed -package_id $package_id + + # Setup user feed if needed + lars_blog_setup_feed -user -package_id $package_id + + # Notifications + lars_blogger::entry::do_notifications -entry_id $entry_id + + # Ping weblogs.com + lars_blog_weblogs_com_update_ping +} + + +ad_proc -public lars_blogger::entry::htmlify { + -array:required +} { + Make the entry displayable in an HTML page +} { + upvar $array row + + set row(title) [ad_quotehtml $row(title)] + + # LARS: + # Not sure we should do the ns_adp_parse thing here, but heck, why not + # It should be safe, given the standard HTML filter security checks, which + # wouldn't let unsafe tags slip through, anyway + + set row(content) [ad_html_text_convert -from $row(content_format) -to "text/html" -- $row(content)] + + # We wrap this in a catch so if it bombs, at least we won't break any pages + catch { + set row(content) [ns_adp_parse -string $row(content)] + } + + # look for the base site name in the url + if {[regexp {^https?://([^ /]+)} $row(title_url) initial base_url] } { + set row(title_url_base) $base_url + } else { + set row(title_url_base) {} + } +} + + + + +ad_proc -public lars_blogger::entry::do_notifications { + {-entry_id:required} +} { # Select all the important information get -entry_id $entry_id -array blog @@ -28,7 +107,11 @@ set new_content "" append new_content "$blog(poster_first_names) $blog(poster_last_name) posted to $blog_name at $blog(posted_time_pretty) on $blog(entry_date_pretty):\n\n" - append new_content "$blog(title)\n\n" + append new_content "$blog(title)\n[string repeat "-" [string length $blog(title)]]\n" + if { ![empty_string_p $blog(title_url)] } { + append new_content "$blog(title_url)\n" + } + append new_content "\n" append new_content "[ad_convert_to_text -- [ns_adp_parse -string $blog(content)]]\n\n" append new_content "This entry: $entry_url\n\n" append new_content "$blog_name: $blog_url\n" Index: openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-oracle.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-oracle.xql 27 Jan 2003 16:19:15 -0000 1.3 +++ openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-oracle.xql 28 Aug 2003 09:41:55 -0000 1.4 @@ -5,20 +5,69 @@ - begin - :1 := pinds_blog_entry.new ( - entry_id => :entry_id, - package_id => :package_id, - title => :title, - content => :content, - content_format => :content_format, - entry_date => to_date(:entry_date, 'YYYY-MM-DD'), - draft_p => :draft_p, - creation_user => :creation_user, - creation_ip => :creation_ip - ); - end; + begin + :1 := pinds_blog_entry.new ( + entry_id => :entry_id, + package_id => :package_id, + title => :title, + title_url => :title_url, + content => :content, + content_format => :content_format, + entry_date => to_date(:entry_date, 'YYYY-MM-DD'), + draft_p => :draft_p, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + + + begin + :1 := weblogger_channel.new ( + null, + :package_id, + NULL, + :creation_user, + :creation_ip + ); + end; + + + + + + begin + :1 := weblogger_channel.new ( + null, + :package_id, + :creation_user, + :creation_user, + :creation_ip + ); + end; + + + + + + begin + :1 := rss_gen_subscr.new ( + null, -- subscr_id + acs_sc_impl.get_id('RssGenerationSubscriber','pinds_blog_entries'), + -- impl_id + :summary_context_id, -- summary_context_id + :timeout, -- timeout + null, -- lastbuild + 'rss_gen_subscr', -- object_type + sysdate, -- creation_date + :creation_user, -- creation_user + :creation_ip, -- creation_ip + :package_id -- context_id + ); + end; + + + Index: openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-postgresql.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-postgresql.xql 27 Jan 2003 16:19:15 -0000 1.3 +++ openacs-4/packages/lars-blogger/tcl/lars-blogger-procs-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.4 @@ -5,18 +5,61 @@ - select pinds_blog_entry__new ( - :entry_id, - :package_id, - :title, - :content, - :content_format, - to_date(:entry_date, 'YYYY-MM-DD'), - :draft_p, - :creation_user, - :creation_ip + select pinds_blog_entry__new ( + :entry_id, + :package_id, + :title, + :title_url, + :content, + :content_format, + to_date(:entry_date, 'YYYY-MM-DD'), + :draft_p, + :creation_user, + :creation_ip ) + + + select weblogger_channel__new ( + null, + :package_id, + NULL, + :creation_user, + :creation_ip + ) + + + + + + select weblogger_channel__new ( + null, + :package_id, + :creation_user, + :creation_user, + :creation_ip + ) + + + + + + select rss_gen_subscr__new ( + null, -- subscr_id + acs_sc_impl__get_id('RssGenerationSubscriber','pinds_blog_entries'), + -- impl_id + :summary_context_id, -- summary_context_id + :timeout, -- timeout + null, -- lastbuild + 'rss_gen_subscr', -- object_type + now(), -- creation_date + :creation_user, -- creation_user + :creation_ip, -- creation_ip + :package_id -- context_id + ) + + + Index: openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl 27 Jan 2003 16:19:15 -0000 1.8 +++ openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.tcl 28 Aug 2003 09:41:55 -0000 1.9 @@ -9,6 +9,7 @@ {-entry_id:required} {-package_id:required} {-title:required} + {-title_url ""} {-content:required} {-content_format:required} {-entry_date:required} @@ -19,15 +20,91 @@ set creation_user [ad_conn user_id] set creation_ip [ns_conn peeraddr] - set entry_id [db_exec_plsql entry_add { *SQL* }] + db_transaction { + # Create the entry + set entry_id [db_exec_plsql entry_add {}] + lars_blog_flush_cache $package_id + } - lars_blog_flush_cache $package_id + # If publish directly, fire off notifications and ping weblogs.com + if { [string equal $draft_p "f"] } { + lars_blogger::entry::publish \ + -entry_id $entry_id \ + -package_id $package_id \ + -no_update + } return $entry_id } +ad_proc lars_blog_setup_feed { + -user:boolean + {-package_id ""} +} { + if { [empty_string_p $package_id] } { + set package_id [ad_conn package_id] + } + + set timeout [expr 30*60] + set channel_title [lars_blog_name] + set creation_user [ad_conn user_id] + set creation_ip [ns_conn peeraddr] + + if { !$user_p } { + if { [parameter::get -parameter "package_rss_feed_p" -default 1]} { + + # check whether there's been a channel setup for this instance + set summary_context_id [db_string select_instance_channel {} -default {}] + + if { [empty_string_p $summary_context_id] } { + # Setup a channel for this instance + set summary_context_id [db_exec_plsql create_instance_channel {}] + } + + # check whether there's been a feed setup for this instance + set exists_instance_feed_p [db_string exists_instance_feed_p {}] + + if { [string equal $exists_instance_feed_p "0"] } { + # Setup an RSS feed for this instance + set channel_link [lars_blog_public_package_url] + + set subscr_id [db_exec_plsql create_subscr {}] + db_dml update_subscr {} + + # Run it now + rss_gen_report $subscr_id + } + } + } else { + if {[parameter::get -parameter "user_rss_feed_p" -default 0]} { + # check whether there's been a channel setup for this instance + set summary_context_id [db_string select_user_channel {} -default {}] + if { [empty_string_p $summary_context_id] } { + # Setup a channel for this instance + set summary_context_id [db_exec_plsql create_user_channel {}] + } + + # check whether there's been a feed setup for this user + set exists_user_feed_p [db_string exists_user_feed_p {}] + set screen_name [db_string screen_name {}] + + if { [string equal $exists_user_feed_p "0"] && ![empty_string_p $screen_name] } { + # Setup an RSS feed for the user + set channel_link "[lars_blog_public_package_url]user/$screen_name/" + + set subscr_id [db_exec_plsql create_subscr {}] + db_dml update_subscr {} + + # Run it now + rss_gen_report $subscr_id + } + } + } +} + + ad_proc -private lars_blog_get_as_string_mem { package_id admin_p Index: openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/tcl/lars-blogger-procs.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,68 @@ + + + + + + + select w.channel_id + from weblogger_channels w + where w.package_id = :package_id + and w.user_id is null + + + + + + select count(*) + from rss_gen_subscrs s, + acs_sc_impls i, + weblogger_channels w + where s.summary_context_id = w.channel_id + and w.package_id = :package_id + and w.user_id is null + and s.impl_id = i.impl_id + and i.impl_name = 'pinds_blog_entries' + and i.impl_owner_name = 'lars-blogger' + + + + + + select w.channel_id + from weblogger_channels w + where w.package_id = :package_id + and w.user_id = :creation_user + + + + + + select count(*) + from rss_gen_subscrs s, + acs_sc_impls i, + weblogger_channels w + where s.summary_context_id = w.channel_id + and w.user_id = :creation_user + and w.package_id = :package_id + and s.impl_id = i.impl_id + and i.impl_name = 'pinds_blog_entries' + and i.impl_owner_name = 'lars-blogger' + + + + + + update rss_gen_subscrs + set channel_title = :channel_title, + channel_link = :channel_link + where subscr_id = :subscr_id + + + + + + select screen_name from users where user_id = :creation_user + + + + Index: openacs-4/packages/lars-blogger/tcl/notification-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/notification-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/tcl/notification-procs.tcl 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,37 @@ +ad_library { + Notification procs for lars-blogger. + + @author Lars Pind (lars@collaboraid.biz) + @creation-date 2003-06-29 + @cvs-id $Id: notification-procs.tcl,v 1.2 2003/08/28 09:41:55 lars Exp $ +} + +namespace eval lars_blogger::notification {} + + +ad_proc -public lars_blogger::notification::get_url { + object_id +} { + Get the URL of a blogger entry. +} { + # LARS: + # Not implemented. Sorry. + # At least this is better than a hard error. + return {} +} + +ad_proc -public lars_blogger::notification::process_reply { + reply_id +} { + Process the reply to a blog posting: Post the reply as a comment. + Not implemented, sorry. +} { + # LARS: + # Not implemented. Sorry. + # At least this is better than a hard error. + + # Return successful_p = "f" + # It doesn't look like notifications does anything with this, though :( + return "f" +} + Index: openacs-4/packages/lars-blogger/tcl/rss-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/rss-procs-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/tcl/rss-procs-oracle.xql 30 Nov 2002 17:37:17 -0000 1.2 +++ openacs-4/packages/lars-blogger/tcl/rss-procs-oracle.xql 28 Aug 2003 09:41:55 -0000 1.3 @@ -5,7 +5,7 @@ - select to_char(sysdate,'DD Mon YYYY hh12:MI am') + select to_char(sysdate,'DD Mon YYYY hh12:MI am') from dual @@ -23,7 +23,7 @@ 0 as tzoffset_minute, to_char(entry_date, 'DD Mon YYYY hh12:MI am') as entry_date_pretty, to_char(entry_date, 'YYYY/MM/') as entry_archive_url - from pinds_blog_entries + from pinds_blog_entries where package_id = :package_id and draft_p = 'f' and deleted_p = 'f' @@ -32,6 +32,34 @@ + + + select * + from (select entry_id, + title, + content, + entry_date, + posted_date, + to_char(posted_date, 'YYYY-MM-DD') as posted_date_string, + to_char(posted_date, 'HH:MI') as posted_time_string, + -6 as tzoffset_hour, + 0 as tzoffset_minute, + to_char(entry_date, 'DD Mon YYYY hh12:MI am') as entry_date_pretty, + to_char(entry_date, 'YYYY/MM/') as entry_archive_url + from pinds_blog_entries e, + acs_objects o, + users u + where e.package_id = :package_id + and o.object_id = e.entry_id + and o.creation_user = :user_id + and u.user_id = o.creation_user + and e.draft_p = 'f' + and e.deleted_p = 'f' + order by e.entry_date desc, e.posted_date desc) + where rownum < 11 + + + select nvl ((max(posted_date)-to_date('1970-01-01'))*60*60*24,0) as last_update @@ -42,4 +70,16 @@ + + + select nvl ((max(posted_date)-to_date('1970-01-01'))*60*60*24,0) as last_update + from pinds_blog_entries e join + acs_objects o on (o.object_id = e.entry_id) + where e.package_id = :package_id + and o.creation_user = :user_id + and e.draft_p = 'f' + and e.deleted_p = 'f' + + + Index: openacs-4/packages/lars-blogger/tcl/rss-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/rss-procs-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/tcl/rss-procs-postgresql.xql 30 Nov 2002 17:37:17 -0000 1.2 +++ openacs-4/packages/lars-blogger/tcl/rss-procs-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.3 @@ -32,10 +32,36 @@ + + + select entry_id, + title, + content, + entry_date, + posted_date, + to_char(posted_date, 'YYYY-MM-DD') as posted_date_string, + to_char(posted_date, 'HH:MI') as posted_time_string, + extract(timezone_hour from now()) as tzoffset_hour, + extract(timezone_minute from now()) as tzoffset_minute, + to_char(entry_date, 'DD Mon YYYY hh12:MI am') as entry_date_pretty, + to_char(entry_date, 'YYYY/MM/') as entry_archive_url + + from pinds_blog_entries e join + acs_objects o on (o.object_id = e.entry_id) join + users u on (u.user_id = o.creation_user) + where e.package_id = :package_id + and o.creation_user = :user_id + and e.draft_p = 'f' + and e.deleted_p = 'f' + order by e.entry_date desc, e.posted_date desc + limit 10 + + + select coalesce (date_part('epoch', - max(posted_date::timestamp with time zone) + max(posted_date::timestamptz) ),0) as last_update from pinds_blog_entries where package_id = :package_id @@ -44,4 +70,18 @@ + + + select coalesce (date_part('epoch', + max(e.posted_date::timestamptz) + ),0) as last_update + from pinds_blog_entries e join + acs_objects o on (o.object_id = e.entry_id) + where e.package_id = :package_id + and o.creation_user = :user_id + and e.draft_p = 'f' + and e.deleted_p = 'f' + + + Index: openacs-4/packages/lars-blogger/tcl/rss-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/rss-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/tcl/rss-procs.tcl 30 Nov 2002 17:37:17 -0000 1.3 +++ openacs-4/packages/lars-blogger/tcl/rss-procs.tcl 28 Aug 2003 09:41:55 -0000 1.4 @@ -6,22 +6,29 @@ } ad_proc -private lars_blog__rss_datasource { - package_id + summary_context_id } { This procedure implements the "datasource" operation of the RssGenerationSubscriber service contract. @author Lars Pind (lars@pinds.com) } { - set package_url [lars_blog_public_package_url -package_id $package_id] - set blog_title [db_string package_name { *SQL* }] + db_transaction { + + db_1row select_package_id_user_id {} + + set package_url [lars_blog_public_package_url -package_id $package_id] + + set blog_title [db_string package_name {}] - set blog_url "[ad_url]$package_url" - + set blog_url "[ad_url]$package_url" + + } + set column_array(channel_title) $blog_title set column_array(channel_description) $blog_title - set column_array(channel_pubDate) [db_string now { *SQL* }] + set column_array(channel_pubDate) [db_string now {}] set column_array(version) 1.00 @@ -42,7 +49,14 @@ set items [list] set counter 0 - db_foreach blog_rss_items { *SQL* } { + + if { [empty_string_p $user_id] } { + set statement "blog_rss_items" + } else { + set statement "user_blog_rss_items" + } + + db_foreach $statement {} { set TZoffset [format "%+03d:%02d" $tzoffset_hour $tzoffset_minute] set entry_url "[ad_url]${package_url}archive/${entry_archive_url}#blog-entry-$entry_id" @@ -77,21 +91,20 @@ } ad_proc -private lars_blog__rss_lastUpdated { - package_id + summary_context_id } { Returns the time that the last blog entry was posted, in Unix time. Returns 0 otherwise. @author Lars Pind (lars@pinds.com) } { - db_0or1row get_last_update { - select coalesce (date_part('epoch', - max(posted_date::timestamp with time zone) - ),0) as last_update - from pinds_blog_entries - where package_id = :package_id - and draft_p = 'f' - and deleted_p = 'f' + + db_1row select_package_id_user_id {} + + if { [empty_string_p $user_id] } { + db_0or1row get_last_update {} + } else { + db_0or1row get_last_user_update {} } return $last_update Index: openacs-4/packages/lars-blogger/tcl/rss-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/rss-procs.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/tcl/rss-procs.xql 19 Aug 2002 21:52:59 -0000 1.1 +++ openacs-4/packages/lars-blogger/tcl/rss-procs.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -2,10 +2,22 @@ + + + select package_id, user_id from weblogger_channels where channel_id = :summary_context_id + + + select instance_name from apm_packages where package_id = :package_id + + + select package_id, user_id from weblogger_channels where channel_id = :summary_context_id + + + Index: openacs-4/packages/lars-blogger/tcl/weblogs-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/weblogs-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/tcl/weblogs-procs.tcl 14 Sep 2002 16:40:33 -0000 1.3 +++ openacs-4/packages/lars-blogger/tcl/weblogs-procs.tcl 28 Aug 2003 09:41:55 -0000 1.4 @@ -106,7 +106,7 @@ return -code error -errorinfo $errorInfo $errMsg } } errmsg ] { - ns_log error "lars_blog_weblogs_com_update_ping error: $errmsg" + ns_log warning "lars_blog_weblogs_com_update_ping error: $errmsg" return -1 } else { ns_log notice "lars_blog_weblogs_com_update_ping: $page" Index: openacs-4/packages/lars-blogger/www/blog-months-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog-months-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/blog-months-oracle.xql 14 Sep 2002 18:37:58 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/blog-months-oracle.xql 28 Aug 2003 09:41:55 -0000 1.3 @@ -3,7 +3,7 @@ oracle8.1.6 - + select trunc(entry_date, 'month') as month_date, to_char(trunc(entry_date, 'month'), 'fmMonthfm YYYY') @@ -18,4 +18,24 @@ + + + select trunc(entry_date, 'month') as month_date, + to_char(trunc(entry_date, 'month'), 'fmMonthfm YYYY') + as date_pretty, + to_char(trunc(entry_date, 'month'), 'YYYY/MM/') + as month_url_stub + from pinds_blog_entries e, + acs_objects o, + users u + where e.draft_p = 'f' + and e.package_id = :package_id + and u.screen_name = :screen_name + and o.object_id = e.entry_id + and u.user_id = o.creation_user + group by trunc(entry_date, 'month') + order by month_date desc + + + Index: openacs-4/packages/lars-blogger/www/blog-months-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog-months-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/blog-months-postgresql.xql 14 Sep 2002 18:37:58 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/blog-months-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.3 @@ -3,7 +3,7 @@ postgresql7.1 - + select date_trunc('month', entry_date) as month_date, to_char(date_trunc('month', entry_date), 'fmMonthfm YYYY') @@ -18,4 +18,22 @@ + + + select date_trunc('month', entry_date) as month_date, + to_char(date_trunc('month', entry_date), 'fmMonthfm YYYY') + as date_pretty, + to_char(date_trunc('month', entry_date), 'YYYY/MM/') + as month_url_stub + from pinds_blog_entries e join + acs_objects o on (o.object_id = e.entry_id) join + users u on (u.user_id = o.creation_user) + where package_id = :package_id + and draft_p = 'f' + and screen_name = :screen_name + group by month_date + order by month_date desc + + + Index: openacs-4/packages/lars-blogger/www/blog-months.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog-months.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/www/blog-months.tcl 14 Sep 2002 18:37:58 -0000 1.3 +++ openacs-4/packages/lars-blogger/www/blog-months.tcl 28 Aug 2003 09:41:55 -0000 1.4 @@ -1,7 +1,13 @@ set package_id [ad_conn package_id] -db_multirow -extend { url } months months { *SQL* } { - set url "[ad_conn package_url]archive/$month_url_stub" +if [empty_string_p $screen_name] { + db_multirow -extend { url } months all_blog_months { *SQL* } { + set url "[ad_conn package_url]archive/$month_url_stub" + } +} else { + db_multirow -extend { url } months one_blog_months { *SQL* } { + set url "[ad_conn package_url]user/$screen_name/archive/$month_url_stub" + } } -ad_return_template \ No newline at end of file +ad_return_template Index: openacs-4/packages/lars-blogger/www/blog-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog-oracle.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/www/blog-oracle.xql 27 Jan 2003 16:19:27 -0000 1.3 +++ openacs-4/packages/lars-blogger/www/blog-oracle.xql 28 Aug 2003 09:41:55 -0000 1.4 @@ -11,10 +11,43 @@ - entry_date > sysdate - 30 + entry_date > sysdate - :num_days + + + select entry_id, + to_char(entry_date, 'fmDayfm, Month fmDDfm, YYYY') as entry_date_pretty, + to_char(entry_date, 'YYYY/MM/DD/') as entry_archive_url, + to_char(entry_date, 'YYYY-MM-DD') as entry_date, + title, + title_url, + content, + content_format, + draft_p, + p.first_names as poster_first_names, + p.last_name as poster_last_name, + o.creation_user as user_id, + to_char(posted_date , 'HH24:MI') as posted_time_pretty, + (select count(gc.comment_id) + from general_comments gc, cr_revisions cr + where gc.object_id = entry_id + and content_item.get_live_revision(gc.comment_id) = cr.revision_id) as num_comments + from pinds_blog_entries e, + acs_objects o, + persons p + where e.entry_id = o.object_id + and p.person_id = o.creation_user + and package_id = :package_id + [ad_decode $date_clause "" "" "and $date_clause"] + and draft_p = 'f' + and deleted_p = 'f' + [ad_decode $limit "" "" "and rownum <= $limit"] + order by entry_date desc, posted_date desc + + + select entry_id, @@ -27,6 +60,7 @@ draft_p, p.first_names as poster_first_names, p.last_name as poster_last_name, + o.creation_user as user_id, to_char(posted_date , 'HH24:MI') as posted_time_pretty, (select count(gc.comment_id) from general_comments gc, cr_revisions cr @@ -37,10 +71,12 @@ persons p where e.entry_id = o.object_id and p.person_id = o.creation_user + and o.creation_user = :blog_user_id and package_id = :package_id - and $date_clause + [ad_decode $date_clause "" "" "and $date_clause"] and draft_p = 'f' and deleted_p = 'f' + [ad_decode $limit "" "" "and rownum <= $limit"] order by entry_date desc, posted_date desc Index: openacs-4/packages/lars-blogger/www/blog-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog-postgresql.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/lars-blogger/www/blog-postgresql.xql 27 Jan 2003 16:19:27 -0000 1.5 +++ openacs-4/packages/lars-blogger/www/blog-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.6 @@ -11,22 +11,24 @@ - entry_date > current_timestamp - interval '30 days' + entry_date > current_timestamp - interval '$num_days days' - + select entry_id, to_char(entry_date, 'fmDayfm, Month fmDDfm, YYYY') as entry_date_pretty, to_char(entry_date, 'YYYY/MM/DD/') as entry_archive_url, to_char(entry_date, 'YYYY-MM-DD') as entry_date, title, + title_url, content, content_format, draft_p, p.first_names as poster_first_names, p.last_name as poster_last_name, + o.creation_user as user_id, to_char(posted_date , 'HH24:MI') as posted_time_pretty, (select count(gc.comment_id) from general_comments gc, cr_revisions cr @@ -36,11 +38,43 @@ acs_objects o on (o.object_id = e.entry_id) join persons p on (p.person_id = o.creation_user) where package_id = :package_id - and $date_clause + [ad_decode $date_clause "" "" "and $date_clause"] and draft_p = 'f' and deleted_p = 'f' order by entry_date desc, posted_date desc + [ad_decode $limit "" "" "limit $limit"] + + + select entry_id, + to_char(entry_date, 'fmDayfm, Month fmDDfm, YYYY') as entry_date_pretty, + to_char(entry_date, 'YYYY/MM/DD/') as entry_archive_url, + to_char(entry_date, 'YYYY-MM-DD') as entry_date, + title, + content, + content_format, + draft_p, + p.first_names as poster_first_names, + p.last_name as poster_last_name, + o.creation_user as user_id, + to_char(posted_date , 'HH24:MI') as posted_time_pretty, + (select count(gc.comment_id) + from general_comments gc, cr_revisions cr + where gc.object_id = entry_id + and content_item__get_live_revision(gc.comment_id) = cr.revision_id) as num_comments + from pinds_blog_entries e join + acs_objects o on (o.object_id = e.entry_id) join + persons p on (p.person_id = o.creation_user) + where package_id = :package_id + and o.creation_user = :blog_user_id + [ad_decode $date_clause "" "" "and $date_clause"] + and draft_p = 'f' + and deleted_p = 'f' + order by entry_date desc, posted_date desc + [ad_decode $limit "" "" "limit $limit"] + + + Index: openacs-4/packages/lars-blogger/www/blog.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog.adp,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/lars-blogger/www/blog.adp 22 May 2003 15:01:04 -0000 1.11 +++ openacs-4/packages/lars-blogger/www/blog.adp 28 Aug 2003 09:41:55 -0000 1.12 @@ -7,9 +7,7 @@
    - - + - + + @blog_name@ @@ -20,23 +18,23 @@
    - +

    - Visit @blog_name@ home + » @blog_name@
    - Visit the archive for @blog_name@ + » Archive
    - - Add an entry to @blog_name@ + + » Add entry -

    \ No newline at end of file +

    Index: openacs-4/packages/lars-blogger/www/blog.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/lars-blogger/www/blog.tcl 4 Jan 2003 09:46:24 -0000 1.9 +++ openacs-4/packages/lars-blogger/www/blog.tcl 28 Aug 2003 09:41:55 -0000 1.10 @@ -4,7 +4,9 @@ # type:optional (current, archive) # archive_interval:optional # archive_date:optional +# screen_name:optional + # If the caller specified a URL, then we gather the package_id from that URL if { [info exists url] } { array set blog_site_node [site_node $url] @@ -16,16 +18,58 @@ set package_id [ad_conn package_id] } -if { ![info exists type] } { - set type "current" +set write_p [permission::permission_p -object_id $package_id -privilege write] + +if { ![info exists screen_name] } { + set screen_name "" + set blog_user_id {} +} else { + set blog_user_id [cc_screen_name_user $screen_name] } +# TODO: +# - Upgrade the installed package to get the latest parameters +# - Test on PG and Oracle + + +set max_num_entries [parameter::get \ + -package_id $package_id \ + -parameter MaxNumEntriesOnFrontPage \ + -default {}] + +set min_num_entries [parameter::get \ + -package_id $package_id \ + -parameter MinNumEntriesOnFrontPage \ + -default {}] + +set num_days [parameter::get \ + -package_id $package_id \ + -parameter NumDaysOnFrontPage \ + -default {}] + + + switch -exact $type { archive { set date_clause "[db_map date_clause_archive]" + set limit {} } + current { + set date_clause {} + set limit {} + + if { ![empty_string_p $max_num_entries] && $max_num_entries != 0 } { + # MaxNumEntriesOnFrontPage parameter is set, which means we should limit to that + set limit $max_num_entries + } + + if { ![empty_string_p $num_days] && $num_days != 0 } { + # NumDaysOnFrontPage parameter is set, which means we should limit to that + set date_clause [db_map date_clause_default] + } + } default { - set date_clause "[db_map date_clause_default]" + error "Only knows of type 'archive' or 'current'" } } @@ -41,16 +85,35 @@ set blog_url {} } -set admin_p [ad_permission_p $package_id admin] +# Check that the date limit is not limiting us to show less than min_num_entries entries +if { ![string equal $type "archive"] && \ + ![empty_string_p $min_num_entries] && $min_num_entries != 0 && \ + ![empty_string_p $num_days] && $num_days != 0 + } { + if { [empty_string_p $blog_user_id] } { + set num_entries [db_string num_entries_by_date_all {}] + } else { + set num_entries [db_string num_entries_by_date {}] + } + + if { $num_entries < $min_num_entries } { + # Eliminate date clause, and set the limit to the minimum number of entries + set date_clause {} + set limit $min_num_entries + } +} -set count 0 +if { [empty_string_p $blog_user_id] } { + db_multirow blog all_blogs { *SQL* } + set archive_url "${package_url}archive/" +} else { + db_multirow blog blog { *SQL* } + set archive_url "${package_url}user/$screen_name/archive/" +} -db_multirow blog blog { *SQL* } - -set archive_url "${package_url}archive/" set arrow_url "${package_url}graphics/arrow-box.gif" -set entry_add_url "${package_url}admin/entry-edit" +set entry_add_url "${package_url}entry-edit" set header_background_color [lars_blog_header_background_color -package_id $package_id] Index: openacs-4/packages/lars-blogger/www/blog.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/blog.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/blog.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,29 @@ + + + + + + select count(entry_id) + from pinds_blog_entries e + where package_id = :package_id + and $date_clause + and draft_p = 'f' + and deleted_p = 'f' + + + + + + select count(entry_id) + from pinds_blog_entries e, + acs_objects i + where e.package_id = :package_id + and o.object_id = e.entry_id + and o.creation_user = :blog_user_id + and $date_clause + and draft_p = 'f' + and deleted_p = 'f' + + + + Index: openacs-4/packages/lars-blogger/www/calendar-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/calendar-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/www/calendar-oracle.xql 27 Jan 2003 16:19:27 -0000 1.1 +++ openacs-4/packages/lars-blogger/www/calendar-oracle.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -3,7 +3,7 @@ oracle8.1.6 - + select to_char(entry_date, 'J') as entry_date_julian from pinds_blog_entries @@ -13,4 +13,21 @@ group by to_char(entry_date, 'J') + + + + + select to_char(entry_date, 'J') as entry_date_julian + from pinds_blog_entries e, + acs_objects o, + users u + where package_id = :package_id + and o.object_id = e.entry_id + and u.user_id = o.creation_user + and u.screen_name = :screen_name + and draft_p = 'f' + and deleted_p = 'f' + group by to_char(entry_date, 'J') + + Index: openacs-4/packages/lars-blogger/www/calendar-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/calendar-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/www/calendar-postgresql.xql 27 Jan 2003 16:19:27 -0000 1.1 +++ openacs-4/packages/lars-blogger/www/calendar-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -3,7 +3,7 @@ postgresql7.1 - + select to_char(entry_date, 'J') as entry_date_julian from pinds_blog_entries @@ -13,4 +13,19 @@ group by entry_date_julian + + + + + select to_char(entry_date, 'J') as entry_date_julian + from pinds_blog_entries e join + acs_objects o on (o.object_id = e.entry_id) join + users u on (u.user_id = o.creation_user) + where package_id = :package_id + and screen_name = :screen_name + and draft_p = 'f' + and deleted_p = 'f' + group by entry_date_julian + + Index: openacs-4/packages/lars-blogger/www/calendar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/calendar.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/www/calendar.adp 22 May 2003 15:01:04 -0000 1.3 +++ openacs-4/packages/lars-blogger/www/calendar.adp 28 Aug 2003 09:41:55 -0000 1.4 @@ -1,4 +1,4 @@ -@notification_chunk;noquote@ +@widget@

    @prev_month_name@ - @next_month_name@ Index: openacs-4/packages/lars-blogger/www/calendar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/calendar.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/www/calendar.tcl 16 Sep 2002 15:04:27 -0000 1.3 +++ openacs-4/packages/lars-blogger/www/calendar.tcl 28 Aug 2003 09:41:55 -0000 1.4 @@ -19,18 +19,42 @@ set package_id [ad_conn package_id] -db_foreach entry_dates { * SQL * } { - ns_set put $calendar_details $entry_date_julian "1" +if {[empty_string_p $screen_name]} { + db_foreach all_entry_dates { * SQL * } { + ns_set put $calendar_details $entry_date_julian "1" + } +} else { + db_foreach entry_dates { * SQL * } { + ns_set put $calendar_details $entry_date_julian "1" + } } +if {[empty_string_p $screen_name]} { + + set day_number_template "\[ad_decode \[ns_set get \$calendar_details \$julian_date\] 1 \"\$day_number\" \$day_number\]" + +} else { + + set day_number_template "\[ad_decode \[ns_set get \$calendar_details \$julian_date\] 1 \"\$day_number\" \$day_number\]" + +} + set widget [dt_widget_month_small \ -date $date \ -calendar_details $calendar_details \ - -day_number_template "\[ad_decode \[ns_set get \$calendar_details \$julian_date\] 1 \"\$day_number\" \$day_number\]"] + -day_number_template $day_number_template] -set prev_month_url "${package_url}archive/[clock format [clock scan $prev_month] -format %Y/%m]/" -set next_month_url "${package_url}archive/[clock format [clock scan $next_month] -format %Y/%m]/" +if {[empty_string_p $screen_name]} { + set prev_month_url "${package_url}archive/[clock format [clock scan $prev_month] -format %Y/%m]/" + set next_month_url "${package_url}archive/[clock format [clock scan $next_month] -format %Y/%m]/" + +} else { + + set prev_month_url "${package_url}user/$screen_name/archive/[clock format [clock scan $prev_month] -format %Y/%m]/" + set next_month_url "${package_url}user/$screen_name/archive/[clock format [clock scan $next_month] -format %Y/%m]/" + +} # Add year to the link append next_month_name " [string range $next_month 0 3]" append prev_month_name " [string range $prev_month 0 3]" Index: openacs-4/packages/lars-blogger/www/drafts-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/Attic/drafts-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/drafts-oracle.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,24 @@ + + + + + + + select entry_id, + to_char(entry_date, 'YYYY-MM-DD') as entry_date_pretty, + title, + title_url, + content, + content_format + from pinds_blog_entries e, + acs_objects o + where package_id = :package_id + and o.object_id = e.entry_id + and o.creation_user = :user_id + and draft_p = 't' + and deleted_p = 'f' + order by entry_date desc, posted_date desc + + + + Index: openacs-4/packages/lars-blogger/www/drafts-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/Attic/drafts-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/drafts-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,22 @@ + + + + + + + select entry_id, + to_char(entry_date, 'YYYY-MM-DD') as entry_date_pretty, + title, + content + from pinds_blog_entries e join + acs_objects o on (o.object_id = e.entry_id) join + persons p on (p.person_id = o.creation_user) + where package_id = :package_id + and o.creation_user = :user_id + and draft_p = 't' + and deleted_p = 'f' + order by entry_date desc, posted_date desc + + + + Index: openacs-4/packages/lars-blogger/www/drafts.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/drafts.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/drafts.adp 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,42 @@ + +@page_title@ +@context@ + + + No draft entries. + + + + + + +
    + + + + + + + + + + + + + +
    DateContentAction
    @draft_entries.entry_date_pretty@ + @draft_entries.title@ + @draft_entries.content@ + + Preview + Publish + Edit + Delete +
    +
    +
    + +

    + Add entry + Add entry +

    Index: openacs-4/packages/lars-blogger/www/drafts.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/drafts.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/drafts.tcl 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,33 @@ +ad_page_contract {} { +} -properties { + context_bar +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +if { [ad_permission_p $package_id admin] } { + set statement "all_draft_entries" +} else { + set statement "draft_entries" +} + +set page_title "Draft Entries" + +set context [list $page_title] + +db_multirow -extend { edit_url publish_url delete_url preview_url } draft_entries $statement {} { + set return_url "[ad_conn url][ad_decode [ad_conn query] "" "" "?[ad_conn query]"]" + set edit_url "[ad_conn package_url]entry-edit?[export_vars { entry_id return_url }]" + set delete_url "[ad_conn package_url]entry-delete?[export_vars { entry_id return_url }]" + set preview_url "[ad_conn package_url]one-entry?[export_vars { entry_id return_url }]" + set publish_url "[ad_conn package_url]entry-publish?[export_vars { entry_id return_url }]" +} + +set entry_add_url "entry-edit" + +set arrow_url "[ad_conn package_url]graphics/arrow-box.gif" + +set header_background_color [lars_blog_header_background_color] + + Index: openacs-4/packages/lars-blogger/www/drafts.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/drafts.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/drafts.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,19 @@ + + + + + + + select entry_id, + to_char(entry_date, 'YYYY-MM-DD') as entry_date_pretty, + title, + content + from pinds_blog_entries + where package_id = :package_id + and draft_p = 't' + and deleted_p = 'f' + order by entry_date desc, posted_date desc + + + + Index: openacs-4/packages/lars-blogger/www/entry-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-chunk.adp,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/lars-blogger/www/entry-chunk.adp 22 May 2003 15:01:04 -0000 1.6 +++ openacs-4/packages/lars-blogger/www/entry-chunk.adp 28 Aug 2003 09:41:55 -0000 1.7 @@ -1,7 +1,16 @@ - -

    @blog.title@

    + +

    + @blog.title@@blog.title_url@ + +   [@blog.title_url_base@] + +

    -

    + + +

    @blog.title@

    +
    + @blog.content@


    @@ -12,7 +21,7 @@
    Posted by @blog.poster_first_names@ @blog.poster_last_name@ at @blog.posted_time_pretty@ - +      Edit - @@ -31,7 +40,7 @@

    # - G - + - @blog.num_comments@ commentcomments @@ -46,11 +55,11 @@

    - +

    Comments

    - @comments_html;noquote@ + @comments_html@
    Add comment
    Index: openacs-4/packages/lars-blogger/www/entry-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-chunk.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/lars-blogger/www/entry-chunk.tcl 27 Jan 2003 16:19:27 -0000 1.5 +++ openacs-4/packages/lars-blogger/www/entry-chunk.tcl 28 Aug 2003 09:41:55 -0000 1.6 @@ -13,14 +13,14 @@ set package_id [ad_conn package_id] } -set admin_p [ad_permission_p $package_id admin] - if { ![exists_and_not_null return_url] } { set return_url "[ad_conn url]?[ad_conn query]" } set package_url [lars_blog_public_package_url -package_id $package_id] +set user_id [ad_conn user_id] + set general_comments_package_url [general_comments_package_url] set show_poster_p [ad_parameter "ShowPosterP" "" "1"] @@ -34,13 +34,18 @@ set entry_id $blog(entry_id) -set blog(edit_url) "${package_url}admin/entry-edit?[export_vars { entry_id return_url }]" -set blog(delete_url) "${package_url}admin/entry-delete?[export_vars { entry_id return_url }]" +set blog(edit_url) "${package_url}entry-edit?[export_vars { entry_id return_url }]" +set blog(delete_url) "${package_url}entry-delete?[export_vars { entry_id return_url }]" -set blog(publish_url) "${package_url}admin/entry-publish?[export_vars { entry_id return_url }]" -set blog(revoke_url) "${package_url}admin/entry-revoke?[export_vars { entry_id return_url }]" +set blog(publish_url) "${package_url}entry-publish?[export_vars { entry_id return_url }]" +set blog(revoke_url) "${package_url}entry-revoke?[export_vars { entry_id return_url }]" -set blog(entry_archive_url) "${package_url}one-entry?[export_vars { entry_id }]" +if { [empty_string_p $screen_name] } { + set blog(entry_archive_url) "${package_url}one-entry?[export_vars { entry_id }]" +} else { + set blog(entry_archive_url) "${package_url}user/$screen_name/one-entry?[export_vars { entry_id }]" +} + set blog(google_url) "http://www.google.com/search?[export_vars { {q $blog(title) } }]" if { ![empty_string_p $general_comments_package_url] } { @@ -53,4 +58,4 @@ set comments_html [general_comments_get_comments -print_content_p 1 $entry_id] } -ad_return_template \ No newline at end of file +ad_return_template Index: openacs-4/packages/lars-blogger/www/entry-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-delete.tcl 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,15 @@ +ad_page_contract {} { + entry_id:integer + {return_url ""} +} + +lars_blogger::entry::require_write_permission -entry_id $entry_id + +db_dml delete { + update pinds_blog_entries + set deleted_p = 't' + where entry_id = :entry_id +} + + +ad_returnredirect $return_url Index: openacs-4/packages/lars-blogger/www/entry-delete.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/Attic/entry-delete.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-delete.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,13 @@ + + + + + + + update pinds_blog_entries + set deleted_p = 't' + where entry_id = :entry_id + + + + Index: openacs-4/packages/lars-blogger/www/entry-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/Attic/entry-edit-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-edit-oracle.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,18 @@ + + + + oracle8.1.6 + + + + select to_char(sysdate, 'YYYY-MM-DD') from dual + + + + + + posted_date = sysdate + + + + Index: openacs-4/packages/lars-blogger/www/entry-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/Attic/entry-edit-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-edit-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,18 @@ + + + + postgresql7.1 + + + + select to_char(current_timestamp, 'YYYY-MM-DD') + + + + + + posted_date = current_timestamp + + + + Index: openacs-4/packages/lars-blogger/www/entry-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-edit.adp 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,13 @@ + +@page_title@ +entry.title +@context@ + + + + + Index: openacs-4/packages/lars-blogger/www/entry-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-edit.tcl 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,164 @@ +ad_page_contract {} { + {entry_id:integer ""} + {return_url ""} + {title:allhtml ""} + {content:allhtml ""} +} + +# Must be logged in +ad_maybe_redirect_for_registration + +# Must have write privilege +permission::require_permission -object_id [ad_conn package_id] -privilege write + +# If we're in DisplayUserP mode, the user must have a screen name setup +if { [parameter::get -parameter "DisplayUsersP" -default 0] } { + acs_user::get -user_id [ad_conn user_id] -array user_info + if { [empty_string_p $user_info(screen_name)] } { + + set page_title "Screen Name" + set context [list $page_title] + set pvt_home_url [ad_pvt_home] + set pvt_home_name [ad_pvt_home_name] + + ad_return_template screen-name-setup + return + } +} + + +set package_id [ad_conn package_id] +set today [db_string today { *SQL* }] +set today_html [ad_quotehtml $today] + +form create entry -cancel_url [ad_decode $return_url "" "." $return_url] + +element create entry title -label "Title" -datatype text -html { size 50 } +element create entry title_url -label "Title URL (optional)" -datatype text -html { size 50 } -optional +element create entry content -label "Content" -datatype richtext -widget richtext -html { cols 80 rows 20 } +element create entry entry_date -label "Entry date" -datatype text \ + -help_text "If you set this to something other than today's date, you must use this form to publish your entry, otherwise the entry date will be set to the date you publish the item." \ + -after_html {(Set to today)} + +element create entry draft_p -label "Post Status" -datatype text -widget select -options { { "Draft" "t" } { "Publish" "f" } } + +element create entry entry_id -widget hidden -datatype text +element create entry insert_or_update -widget hidden -datatype text +element create entry return_url -widget hidden -datatype text -value $return_url + +if { [form is_request entry] } { + + if { [empty_string_p $entry_id] } { + set insert_or_update insert + set entry_id [db_nextval "acs_object_id_seq"] + element set_properties entry entry_date -value $today + element set_properties entry draft_p -value "t" + + # Prefill title and content with supplied values + foreach element { content title } { + if { [exists_and_not_null $element] } { + element set_value entry $element [set $element] + } + } + } else { + set insert_or_update update + + lars_blogger::entry::require_write_permission -entry_id $entry_id + + db_1row entry { *SQL* } + + element set_value entry title $title + element set_value entry title_url $title_url + + set content_data [template::util::richtext::acquire contents $content] + set content_data [template::util::richtext::set_property format $content_data $content_format] + + element set_value entry content $content_data + + element set_value entry entry_date $entry_date + element set_value entry draft_p $draft_p + } + + element set_properties entry entry_id -value $entry_id + element set_properties entry insert_or_update -value $insert_or_update +} + + +if { [form is_valid entry] } { + set entry_id [element get_value entry entry_id] + set title [element get_value entry title] + set title_url [element get_value entry title_url] + set content [template::util::richtext::get_property contents [element get_value entry content]] + set content_format [template::util::richtext::get_property format [element get_value entry content]] + set entry_date [element get_value entry entry_date] + set draft_p [element get_value entry draft_p] + set draft_p [ad_decode $draft_p "" "f" $draft_p] + + set return_url [element get_value entry return_url] + set insert_or_update [element get_value entry insert_or_update] + + if { [string equal $insert_or_update "insert"] } { + lars_blog_entry_add \ + -entry_id $entry_id \ + -package_id $package_id \ + -title $title \ + -title_url $title_url \ + -content $content \ + -content_format $content_format \ + -entry_date $entry_date \ + -draft_p "$draft_p" + } else { + lars_blogger::entry::require_write_permission -entry_id $entry_id + + set set_clauses { + "title = :title" + "title_url = :title_url" + "content = :content" + "content_format = :content_format" + "entry_date = to_date(:entry_date, 'YYYY-MM-DD')" + "draft_p = :draft_p" + } + + set org_draft_p [db_string org_draft_p { select draft_p from pinds_blog_entries where entry_id = :entry_id } ] + + # Is this a publish? + if { [string equal $draft_p "t"] && [string equal $org_draft_p "f"] } { + # set the posted_date to now + lappend set_clauses [db_map now] + } + + db_dml update_entry { *SQL* } + + # Is this a publish? + if { [string equal $draft_p "t"] && [string equal $org_draft_p "f"] } { + # do notifications + lars_blogger::entry::do_notifications -entry_id $entry_id + # and ping weblogs.com + lars_blog_weblogs_com_update_ping + } + + lars_blog_flush_cache $package_id + } + + if { [empty_string_p $return_url] } { + set return_url "[ad_conn package_url]one-entry?[export_vars { entry_id }]" + } + + ad_returnredirect $return_url + ad_script_abort +} + +if { ![form is_request entry] && ![form is_valid entry] } { + set insert_or_update [element get_value entry insert_or_update] +} + +switch -- $insert_or_update { + insert { + set page_title "Add Blog Entry" + } + update { + set page_title "Edit Blog Entry" + } +} + +set context [list $page_title] Index: openacs-4/packages/lars-blogger/www/entry-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-edit.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-edit.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,37 @@ + + + + + + + select count(*) + from pinds_blog_entries + where entry_id = :entry_id + + + + + + select draft_p + from pinds_blog_entries + where entry_id = :entry_id + + + + + + select title, title_url, content, content_format, draft_p, to_char(entry_date, 'YYYY-MM-DD') as entry_date + from pinds_blog_entries + where entry_id = :entry_id + + + + + + update pinds_blog_entries + set [join $set_clauses ", "] + where entry_id = :entry_id + + + + Index: openacs-4/packages/lars-blogger/www/entry-publish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-publish.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-publish.tcl 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,11 @@ +ad_page_contract {} { + entry_id:integer + {return_url "index"} +} + +lars_blogger::entry::require_write_permission -entry_id $entry_id + +lars_blogger::entry::publish \ + -entry_id $entry_id \ + -redirect_url $return_url + Index: openacs-4/packages/lars-blogger/www/entry-revoke.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-revoke.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-revoke.tcl 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,12 @@ +ad_page_contract {} { + entry_id:integer + {return_url "index"} +} + +db_dml update_entry { *SQL* } + +ad_returnredirect $return_url +ns_conn close + +# Flush cache +lars_blog_flush_cache Index: openacs-4/packages/lars-blogger/www/entry-revoke.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/entry-revoke.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/entry-revoke.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,13 @@ + + + + + + + update pinds_blog_entries + set draft_p = 't' + where entry_id = :entry_id + + + + Index: openacs-4/packages/lars-blogger/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/index-oracle.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,19 @@ + + + + oracle8.1.6 + + + + select distinct u.screen_name, u.user_id + from pinds_blog_entries e, + acs_objects o, + users u + where package_id = :package_id + and o.object_id = e.entry_id + and u.user_id = o.creation_user + and u.screen_name is not null + + + + Index: openacs-4/packages/lars-blogger/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/index-postgresql.xql 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,17 @@ + + + + postgresql7.1 + + + + select distinct u.screen_name, u.user_id + from pinds_blog_entries e join + acs_objects o on (o.object_id = e.entry_id) join + users u on (u.user_id = o.creation_user) + where e.package_id = :package_id + and u.screen_name != '' + + + + Index: openacs-4/packages/lars-blogger/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index.adp,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/lars-blogger/www/index.adp 22 May 2003 15:01:04 -0000 1.12 +++ openacs-4/packages/lars-blogger/www/index.adp 28 Aug 2003 09:41:55 -0000 1.13 @@ -1,14 +1,51 @@ -@page_title;noquote@ +@page_title@ - + -@context_bar;noquote@ +@context_bar@ + + + + + + + + No bloggers here. + + + + +

    + » Add entry
    +

    +
    + +

    + » Start your weblog
    +

    +
    +
    + + +

    + » Administer +

    +
    + +
    + + + @@ -29,35 +66,35 @@ - + - + - + - + @@ -67,7 +104,7 @@ - + - @@ -103,3 +140,4 @@
    - + @@ -20,7 +57,7 @@
    - +
    Actions
    - Add entry
    - Draft entries
    -
    Administer + Add entry
    + Draft entries + +
    Administer +
    -
    -
     
    Notifications
    - @notification_chunk;noquote@ + @notification_chunk@
    Archive @@ -92,7 +129,7 @@
    + RSS 1.0/RDF/XML
    +
    Index: openacs-4/packages/lars-blogger/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/index.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/lars-blogger/www/index.tcl 30 Jan 2003 16:56:22 -0000 1.7 +++ openacs-4/packages/lars-blogger/www/index.tcl 28 Aug 2003 09:41:55 -0000 1.8 @@ -4,24 +4,62 @@ @author Lars Pind (lars@pinds.com) @creation-date February 2002 } { + screen_name:optional year:optional,string_length_range(4|4) month:optional,string_length_range(2|2) day:optional,string_length_range(2|2) -} -properties { - context_bar - page_title } -set context_bar [ad_context_bar] - set page_title [lars_blog_name] -if { ![empty_string_p [ad_parameter "rss_file_url"]] } { - set rss_file_url "[ad_url][lars_blog_public_package_url][ad_parameter "rss_file_url"]" +if {![exists_and_not_null screen_name]} { + set screen_name "" + set context_bar [ad_context_bar] +} else { + set context_bar [ad_context_bar $screen_name] } -set admin_p [ad_permission_p [ad_conn package_id] admin] +if { ![empty_string_p [parameter::get -parameter "rss_file_name"]] } { + if {[exists_and_not_null screen_name]} { + set rss_file_url "[ad_url][lars_blog_public_package_url]user/$screen_name/rss/[parameter::get -parameter "rss_file_name"]" + } else { + set rss_file_url "[ad_url][lars_blog_public_package_url]rss/[parameter::get -parameter "rss_file_name"]" + } + +} + +set package_id [ad_conn package_id] + +set package_url [ad_conn package_url] + +set write_p [permission::permission_p -object_id $package_id -privilege write] +set admin_p [permission::permission_p -object_id $package_id -privilege admin] + +set display_users_p [parameter::get -parameter "DisplayUsersP" -default 0] + +if {$display_users_p && ![exists_and_not_null screen_name]} { + + set display_bloggers_p 1 + + db_multirow bloggers bloggers { *SQL* } + + set user_has_blog_p 0 + multirow foreach bloggers { + if { $user_id == [ad_conn user_id] } { + set user_has_blog_p 1 + break + } + } + + ad_return_template + +} else { + + set display_bloggers_p 0 + +} + set notification_chunk [notification::display::request_widget \ -type lars_blogger_notif \ -object_id [ad_conn package_id] \ @@ -40,11 +78,19 @@ if { [exists_and_not_null day] } { set interval "day" db_1row archive_date_month_day { *SQL* } - set context_bar [ad_context_bar [list "[ad_conn package_url]archive/" "Archive"] [list "[ad_conn package_url]archive/$year/$month/" $archive_month_pretty] $archive_date_pretty] + if {[empty_string_p $screen_name]} { + set context_bar [ad_context_bar [list "$package_url/archive/" "Archive"] [list "$package_url/archive/$year/$month/" $archive_month_pretty] $archive_date_pretty] + } else { + set context_bar [ad_context_bar [list "$package_url/user/$screen_name/" "$screen_name"] [list "$package_url/user/$screen_name/archive/" "Archive"] [list "$package_url/user/$screen_name/archive/$year/$month/" $archive_month_pretty] $archive_date_pretty] + } } else { set interval "month" db_1row archive_date_month { *SQL* } - set context_bar [ad_context_bar [list "[ad_conn package_url]archive/" "Archive"] $archive_date_pretty] + if {[empty_string_p $screen_name]} { + set context_bar [ad_context_bar [list "$package_url/archive/" "Archive"] $archive_date_pretty] + } else { + set context_bar [ad_context_bar [list "$package_url/user/$screen_name/" "$screen_name"] [list "$package_url/user/$screen_name/archive/" "Archive"] $archive_date_pretty] + } } append page_title " Archive" Index: openacs-4/packages/lars-blogger/www/one-entry.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/one-entry.adp,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/lars-blogger/www/one-entry.adp 22 May 2003 15:01:04 -0000 1.7 +++ openacs-4/packages/lars-blogger/www/one-entry.adp 28 Aug 2003 09:41:55 -0000 1.8 @@ -1,6 +1,6 @@ -@page_title;noquote@ -@context_bar;noquote@ +@page_title@ +@context_bar@ @@ -10,4 +10,4 @@
    - \ No newline at end of file + Index: openacs-4/packages/lars-blogger/www/one-entry.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/one-entry.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/lars-blogger/www/one-entry.tcl 14 Sep 2002 22:05:25 -0000 1.5 +++ openacs-4/packages/lars-blogger/www/one-entry.tcl 28 Aug 2003 09:41:55 -0000 1.6 @@ -13,8 +13,6 @@ set package_id [ad_conn package_id] -set admin_p [ad_permission_p $package_id admin] - if { [empty_string_p $return_url] } { set return_url "[ad_conn url]?[ad_conn query]" } @@ -25,8 +23,13 @@ set page_title $blog(title) -set context_bar [ad_context_bar $page_title] +if {![exists_and_not_null screen_name]} { + set screen_name "" + set context_bar [ad_context_bar $page_title] +} else { + set context_bar [ad_context_bar $screen_name] +} set header_background_color [lars_blog_header_background_color] -ad_return_template \ No newline at end of file +ad_return_template Index: openacs-4/packages/lars-blogger/www/screen-name-setup.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/screen-name-setup.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/screen-name-setup.adp 28 Aug 2003 09:41:55 -0000 1.2 @@ -0,0 +1,11 @@ + +@page_title@ +@context@ + +

    + Before you can start using your web log, you must setup a screen name at @pvt_home_name@. +

    + +

    + » Visit @pvt_home_name@ to set up your screen name. +

    Index: openacs-4/packages/lars-blogger/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/admin/index.adp,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/lars-blogger/www/admin/index.adp 22 May 2003 15:01:34 -0000 1.7 +++ openacs-4/packages/lars-blogger/www/admin/index.adp 28 Aug 2003 09:41:56 -0000 1.8 @@ -1,42 +1,43 @@ -@title;noquote@ +@title@

    These are your administrative options

    - Add new blog entry - Add new blog entry + » + Add new blog entry

    - View draft entries - View draft entries + » + View draft entries

    - Show E-Mail subscribers + » Show E-Mail subscribers

    - Set parameters + » Set parameters

    - +

    - Setup an RSS feed - Setup an RSS feed + » + Manage your RSS feeds (View instance feed XML)

    - + +

    - Manage your RSS feed - Manage your RSS feed + » + Setup instance RSS feed

    -
    +
    -
    \ No newline at end of file + Index: openacs-4/packages/lars-blogger/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/admin/index.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/www/admin/index.tcl 30 Jan 2003 16:56:39 -0000 1.3 +++ openacs-4/packages/lars-blogger/www/admin/index.tcl 28 Aug 2003 09:41:56 -0000 1.4 @@ -15,11 +15,12 @@ set arrow_url "[lars_blog_public_package_url -package_id $package_id]graphics/arrow-box.gif" -set rss_feed_p [db_string rss_feed_p {}] +set instance_feed_p [db_string rss_feed_p {}] set rss_setup_url "rss-setup" set rss_manage_url "[apm_package_url_from_key "rss-support"]my-subscrs" -ad_return_template - +if { ![empty_string_p [parameter::get -parameter "rss_file_name"]] } { + set rss_file_url "[ad_url][lars_blog_public_package_url]rss/[parameter::get -parameter "rss_file_name"]" +} Index: openacs-4/packages/lars-blogger/www/admin/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/admin/index.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/admin/index.xql 30 Jan 2003 16:56:39 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/admin/index.xql 28 Aug 2003 09:41:56 -0000 1.3 @@ -13,8 +13,9 @@ select count(*) from rss_gen_subscrs s, - acs_sc_impls i - where s.summary_context_id = :package_id + acs_sc_impls i, weblogger_channels w + where w.package_id = :package_id + and s.summary_context_id = w.channel_id and s.impl_id = i.impl_id and i.impl_name = 'pinds_blog_entries' and i.impl_owner_name = 'lars-blogger' Index: openacs-4/packages/lars-blogger/www/admin/rss-setup-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/admin/rss-setup-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/admin/rss-setup-oracle.xql 28 Aug 2003 09:41:56 -0000 1.2 @@ -0,0 +1,28 @@ + + + + oracle8.1.6 + + + + begin + :1 := rss_gen_subscr.new ( + null, + acs_sc_impl.get_id( + impl_contract_name => 'RssGenerationSubscriber', + impl_name => 'pinds_blog_entries' + ), + :package_id, + :timeout, + null, + 'rss_gen_subscr', + sysdate, + :creation_user, + :creation_ip, + :package_id + ); + end; + + + + Index: openacs-4/packages/lars-blogger/www/admin/rss-setup-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/admin/rss-setup-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/admin/rss-setup-postgresql.xql 28 Aug 2003 09:41:56 -0000 1.2 @@ -0,0 +1,24 @@ + + + + postgresql7.1 + + + + select rss_gen_subscr__new ( + null, -- subscr_id + acs_sc_impl__get_id('RssGenerationSubscriber','pinds_blog_entries'), + -- impl_id + :package_id, -- summary_context_id + :timeout, -- timeout + null, -- lastbuild + 'rss_gen_subscr', -- object_type + now(), -- creation_date + :creation_user, -- creation_user + :creation_ip, -- creation_ip + :package_id -- context_id + ) + + + + Index: openacs-4/packages/lars-blogger/www/admin/rss-setup.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/admin/rss-setup.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/www/admin/rss-setup.tcl 30 Jan 2003 16:56:39 -0000 1.1 +++ openacs-4/packages/lars-blogger/www/admin/rss-setup.tcl 28 Aug 2003 09:41:56 -0000 1.2 @@ -2,23 +2,7 @@ Setup an RSS feed for this blogger. } -set creation_user [ad_conn user_id] -set creation_ip [ns_conn peeraddr] +# Setup instance feed if needed +lars_blog_setup_feed -# by default, we timout in 30 minutes -set timeout [expr 30*60] - -set package_id [ad_conn package_id] - -set channel_title [lars_blog_name] -set channel_link [lars_blog_public_package_url] - -db_transaction { - - set subscr_id [db_string create_subscr {}] - - db_dml update_subscr {} - -} - -ad_returnredirect . \ No newline at end of file +ad_returnredirect . Index: openacs-4/packages/lars-blogger/www/admin/rss-setup.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/admin/rss-setup.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/www/admin/rss-setup.xql 30 Jan 2003 16:56:39 -0000 1.1 +++ openacs-4/packages/lars-blogger/www/admin/rss-setup.xql 28 Aug 2003 09:41:56 -0000 1.2 @@ -2,24 +2,6 @@ - - - select rss_gen_subscr__new ( - null, -- subscr_id - acs_sc_impl__get_id('RssGenerationSubscriber','pinds_blog_entries'), - -- impl_id - :package_id, -- summary_context_id - :timeout, -- timeout - null, -- lastbuild - 'rss_gen_subscr', -- object_type - now(), -- creation_date - :creation_user, -- creation_user - :creation_ip, -- creation_ip - :package_id -- context_id - ) - - - update rss_gen_subscrs Index: openacs-4/packages/lars-blogger/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/doc/index.html,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/lars-blogger/www/doc/index.html 6 Feb 2003 08:59:15 -0000 1.3 +++ openacs-4/packages/lars-blogger/www/doc/index.html 28 Aug 2003 09:41:56 -0000 1.4 @@ -1,20 +1,20 @@ -Lars Pind's Blogger Documentation +Weblogger Documentation -

    Lars Pind's Blogger Documentation

    -By Lars Pind +

    Weblogger Documentation

    +By Lars Pind and Simon Carstensen
    -

    Why

    +

    Download

    @@ -27,8 +27,8 @@

    Install the package on your system, mount a new instance somewhere - on the site map, make sure you have admin permission on the - instance, and then visit /admin under the URL where you mounted + on the site map, make sure you have write permission on the + instance, and then visit the URL where you mounted it. Now you can add your first blog entry.

    @@ -88,18 +88,21 @@

    Technical Info

    - The package fully supports multiple instances, i.e., you can mount + The package fully supports multiple instances. You can mount several instances in your site map, and they'll stay properly isolated - from each other. + from each other. Alternatively you can let multiple users post to one + instance by granting write permissions. Mounting Weblogger under, say, + /blog, you will have /blog/user/screenname displaying the entries of one + user and /blog displaying either a list of all bloggers (this is done by + setting the parameter DisplayUsersP to 1) or all entries posted to the + instance (the default).

    Contents in your blog entries are assumed to be full-blooded - ADP-ified HTML, so don't give people access to post a blog unless - you trust them. I guess it should be made configurable whether to - allow this or not, but since I'm developing this for my own site - primarily, I haven't done so. This also means that if you've added - custom ADP tags, those are also available to you in your blog. + ADP-ified HTML, so don't give people access to post a blog (i.e. grant + write permissions on the instance) unless you trust them. This also means + that if you've added custom ADP tags, those are also available to you in your blog.

    weblogs.com update ping

    @@ -124,7 +127,7 @@

    Then you'll need to set the parameters and say that your - rss_file_url is at + rss_file_name is at /where-your-blogger-instnace-sists/rss/rss.xml. If you leave this blank, we won't advertise your RSS feed URL anywhere.

    @@ -137,39 +140,54 @@

    Road Map

      +
    • Categorize and full-text-search-index blog entries so the archives + are more useful.
    • - Categorize and full-text-search-index blog entries so the archives - are more useful. + Use content repository.
    • +
    • Ability to modify templates for each instance individually through + the UI.
    • +
    • Support for Trackback
    • +
    • Support for the Blogger and MetaWeblog APIs
    • +
    • WYISIYG editor
    • +
    • Improved RSS feed
    • +
    • Improved Configuration Settings.
    • +
    • Make it safe to use in a not-so-protected environment, e.g., + disable <% ... %> ADP notation.
    • +
    • Better documentation.
    • - Use content repository. + Moderation-feature: Entries posted by non-admins must go through a + workflow-administered approval process.
    • - Community-maintained blog ... everybody with 'write' can post entries. + Nicer interface (MovableType)
    • +
    + +

    Version History

    + +
    • - Moderation-feature: Entries posted by non-admins must go through a - workflow-administered approval process. + 0.9.2 Added parameters to control the number of entries shown + on the front page (July 10, 2003)
    • - Ability to modify templates for each instance individually through - the UI. + 0.9 Added support for multiple users. (June 10, 2003)
    • - Nicer interface (MovableType) + 0.8.7 Fixed notifications to include the title_url, and + to not have extra spaces in the month name. (May 11, 2003)
    • - Make it safe to use in a not-so-protected environment, e.g., - disable <% ... %> ADP notation. + 0.8.6 Cleaned up RSS-support even more and made it work + under Oracle. Also made a slight style change, using the + &raquo; (») style for action links, which I've adopted + for other packages. It's less intrusive than the harshly-colored + arrow-box.gif I used to use. (May 9, 2003)
    • - More thorough documentation and some setup/config pages. + 0.8.5 Added title URL, cleanup (March 28, 2003)
    • -
    - -

    Version History

    - -
    • 0.8.4 Oops, getting behind on the version history. In the last few releases, I've rearranged a bunch of templates to make it @@ -232,4 +250,4 @@
      lars@pinds.com
      - \ No newline at end of file + Index: openacs-4/packages/lars-blogger/www/rss/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/rss/index.vuh,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/www/rss/index.vuh 30 Nov 2002 17:38:04 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/rss/index.vuh 28 Aug 2003 09:41:56 -0000 1.3 @@ -1 +1,12 @@ -ns_returnfile 200 text/xml [rss_gen_report_file -summary_context_id [ad_conn package_id] -impl_name pinds_blog_entries] +set extra_url_list [split [ad_conn extra_url] "/"] + +set package_id [ad_conn package_id] + +set summary_context_id [db_string package_id { + select channel_id as summary_context_id + from weblogger_channels w + where w.package_id = :package_id + and w.user_id is null +}] + +ns_returnfile 200 text/xml [rss_gen_report_file -summary_context_id $summary_context_id -impl_name pinds_blog_entries] Index: openacs-4/packages/lars-blogger/www/user/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/user/Attic/index.vuh,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/user/index.vuh 28 Aug 2003 09:45:30 -0000 1.2 @@ -0,0 +1,62 @@ +set extra_url_list [split [ad_conn extra_url] "/"] + +if { [lindex $extra_url_list 2] == "archive" } { + set screen_name [lindex $extra_url_list 1] + set year [lindex $extra_url_list 3] + set month [lindex $extra_url_list 4] + set day [lindex $extra_url_list 5] + + set sql "select user_id from users where screen_name = '$screen_name'" + + if { [empty_string_p $screen_name] || ![db_0or1row select_user_id $sql] } { + ad_returnredirect [ad_conn package_url] + } elseif { [empty_string_p $year] && [empty_string_p $month] && [empty_string_p $day] } { + set date_list [dt_ansi_to_list [dt_sysdate]] + ad_returnredirect "[ad_conn package_url]user/$screen_name/archive/[lindex $date_list 0]/[format "%02d" [lindex $date_list 1]]/" + } else { + rp_form_put screen_name $screen_name + rp_form_put year $year + rp_form_put month $month + rp_form_put day $day + + rp_internal_redirect "/packages/lars-blogger/www/index" + } + +} elseif { [lindex $extra_url_list 2] == "rss" } { + + set package_id [ad_conn package_id] + + set screen_name [lindex $extra_url_list 1] + + set sql "select channel_id as summary_context_id + from weblogger_channels w, users u + where w.user_id = u.user_id + and u.screen_name = :screen_name + and w.package_id = :package_id" + + set summary_context_id [db_string select_user_id $sql] + + ns_log "Notice" "SUM: $summary_context_id" + + ns_returnfile 200 text/xml [rss_gen_report_file -summary_context_id $summary_context_id -impl_name pinds_blog_entries] + +} else { + +set screen_name [lindex $extra_url_list 1] + +set sql "select count(*) from users where screen_name = '$screen_name'" + +if { [empty_string_p $screen_name] || ![db_0or1row select_user_id $sql]} { + ad_returnredirect [ad_conn package_url] +} else { + + if { [lindex $extra_url_list 2] == "one-entry" } { + rp_form_put screen_name $screen_name + rp_internal_redirect "/packages/lars-blogger/www/one-entry" + } + + rp_form_put screen_name $screen_name + rp_internal_redirect "/packages/lars-blogger/www/index" +} + +} Index: openacs-4/packages/lars-blogger/www/user/archive/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/user/archive/Attic/index.vuh,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/user/archive/index.vuh 28 Aug 2003 09:45:30 -0000 1.2 @@ -0,0 +1,22 @@ +set extra_url_list [split [ad_conn extra_url] "/"] + +set screen_name [lindex $extra_url_list 1] +set year [lindex $extra_url_list 2] +set month [lindex $extra_url_list 3] +set day [lindex $extra_url_list 4] + +set sql "select user_id from users where screen_name = '$screen_name'" + +if { [empty_string_p $screen_name] || ![db_0or1row select_user_id $sql]} { + ad_returnredirect [ad_conn package_url] +} elseif { [empty_string_p $year] || [empty_string_p $month] || [empty_string_p $day] } { + set date_list [dt_ansi_to_list [dt_sysdate]] + ad_returnredirect "[ad_conn package_url]$screen_name/archive/[lindex $date_list 0]/[format "%02d" [lindex $date_list 1]]/" +} else { + rp_form_put screen_name $screen_name + rp_form_put year $year + rp_form_put month $month + rp_form_put day $day + + rp_internal_redirect "/packages/lars-blogger/www/index" +} Index: openacs-4/packages/logger/logger.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/logger.info,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/logger/logger.info 9 May 2003 15:07:00 -0000 1.6 +++ openacs-4/packages/logger/logger.info 28 Aug 2003 09:45:30 -0000 1.7 @@ -15,6 +15,7 @@ Collaboraid + Index: openacs-4/packages/logger/tcl/project-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/project-procs.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/logger/tcl/project-procs.tcl 1 May 2003 14:14:33 -0000 1.6 +++ openacs-4/packages/logger/tcl/project-procs.tcl 28 Aug 2003 09:45:30 -0000 1.7 @@ -100,6 +100,24 @@ db_dml update_project {} } +ad_proc -public logger::project::set_active_p { + {-project_id:required} + {-active_p:required} +} { + Set a Logger project active/inactive. + + @param project_id The id of the project to edit + @param active_p The new value for active_p, must be t (true) or f (false) + + @return The return value from db_dml + + @author Lars Pind (lars@collaboraid.biz) +} { + ad_assert_arg_value_in_list active_p {t f} + + db_dml update_project {} +} + ad_proc -public logger::project::delete { {-project_id:required} } { @@ -258,4 +276,16 @@ @author Peter Marklund } { return [db_string select_primary_variable {} -default ""] -} \ No newline at end of file +} + +ad_proc -private logger::project::users_get_options {} { + Get the list of users to display in a drop-down to pick project lead. +} { + set package_id [ad_conn package_id] + + set users_list [db_list_of_lists select_project_leads {}] + + lappend users_list { "Search..." ":search:"} + + return $users_list +} Index: openacs-4/packages/logger/tcl/project-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/project-procs.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/logger/tcl/project-procs.xql 1 May 2003 14:14:33 -0000 1.5 +++ openacs-4/packages/logger/tcl/project-procs.xql 28 Aug 2003 09:45:30 -0000 1.6 @@ -83,4 +83,23 @@ + + + update logger_projects + set active_p = :active_p + where project_id = :project_id + + + + + + + select acs_object__name(p.project_lead), project_lead + from logger_projects p, + logger_project_pkg_map ppm + where ppm.project_id = p.project_id + and ppm.package_id = :package_id + + + Index: openacs-4/packages/logger/tcl/projection-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/projection-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/logger/tcl/projection-procs.tcl 2 May 2003 08:34:43 -0000 1.3 +++ openacs-4/packages/logger/tcl/projection-procs.tcl 28 Aug 2003 09:45:30 -0000 1.4 @@ -17,7 +17,7 @@ {-end_time:required} {-value:required} {-name:required} - {-description:required} + {-description ""} } { Create a new projection for a certain variable and project. @@ -31,6 +31,8 @@ @param value The anticipated or targeted value (a sum for additive variables, an average for non-additive variables). + @param name Used when listing or displaying the projection in the UI. + @param description Describes the projection. Optional. @return The id of the created projection. Will throw an error if a projection_id is provided and a projection with that id already exists in the database. Index: openacs-4/packages/logger/tcl/ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/ui-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/logger/tcl/ui-procs.tcl 9 May 2003 15:07:27 -0000 1.7 +++ openacs-4/packages/logger/tcl/ui-procs.tcl 28 Aug 2003 09:45:30 -0000 1.8 @@ -101,18 +101,5 @@ @author Peter Marklund } { set package_id [ad_conn package_id] - - set project_options [list] - db_foreach project_options { - select lp.project_id, - lp.name - from logger_projects lp, - logger_project_pkg_map lppm - where lp.project_id = lppm.project_id - and lppm.package_id = :package_id - } { - lappend project_options [list $name $project_id] - } - - return $project_options + return [db_list_of_lists project_options {}] } Index: openacs-4/packages/logger/tcl/ui-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/ui-procs.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/logger/tcl/ui-procs.xql 9 May 2003 15:07:27 -0000 1.2 +++ openacs-4/packages/logger/tcl/ui-procs.xql 28 Aug 2003 09:45:30 -0000 1.3 @@ -13,5 +13,16 @@ + + + select lp.name, + lp.project_id + from logger_projects lp, + logger_project_pkg_map lppm + where lp.project_id = lppm.project_id + and lppm.package_id = :package_id + order by name + + Index: openacs-4/packages/logger/tcl/test/logger-test-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/test/logger-test-init.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/logger/tcl/test/logger-test-init.tcl 1 May 2003 14:15:28 -0000 1.7 +++ openacs-4/packages/logger/tcl/test/logger-test-init.tcl 28 Aug 2003 09:45:30 -0000 1.8 @@ -41,6 +41,7 @@ set projection_start_time "2003-04-10" set projection_end_time "2003-04-20" set projection_value "10" + set projection_name "Test Projection" array set hour_entry_1 { value 11 time_stamp "2003-04-15" @@ -116,7 +117,8 @@ -variable_id $hours_var_id \ -start_time $projection_start_time \ -end_time $projection_end_time \ - -value $projection_value] + -value $projection_value \ + -name $projection_name] # Assert that projection values can be retrieved logger::projection::get -projection_id $projection_id -array projection Index: openacs-4/packages/logger/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/index.adp,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/logger/www/index.adp 22 May 2003 15:01:52 -0000 1.9 +++ openacs-4/packages/logger/www/index.adp 28 Aug 2003 09:45:30 -0000 1.10 @@ -1,5 +1,5 @@ -Logger Application +@instance_name@ @@ -69,7 +69,8 @@ projection_value="@selected_projection_value;noquote@" selected_user_id="@selected_user_id;noquote@" start_date_ansi="@selected_start_date;noquote@" - end_date_ansi="@selected_end_date;noquote@"/> + end_date_ansi="@selected_end_date;noquote@" + group_by="@selected_group_by;noquote@" /> Index: openacs-4/packages/logger/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/index.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/logger/www/index.tcl 9 May 2003 15:07:48 -0000 1.10 +++ openacs-4/packages/logger/www/index.tcl 28 Aug 2003 09:45:30 -0000 1.11 @@ -11,10 +11,20 @@ {selected_user_id:integer ""} {selected_start_date ""} {selected_end_date ""} + {selected_group_by ""} } +if { [empty_string_p [ad_conn query]] } { + set weekdayno [clock format [clock seconds] -format %w] + set new_start_date [clock format [clock scan "-$weekdayno days"] -format "%Y-%m-%d"] + set new_end_date [clock format [clock scan "[expr 6-$weekdayno] days"] -format "%Y-%m-%d"] + ad_returnredirect ".?[export_vars { { selected_start_date $new_start_date } { selected_end_date $new_end_date } { selected_group_by "time_stamp" } }]" + ad_script_abort +} + set package_id [ad_conn package_id] set current_user_id [ad_conn user_id] +set instance_name [ad_conn instance_name] set admin_p [permission::permission_p -object_id $package_id -privilege admin] set filter_var_list { @@ -24,6 +34,7 @@ selected_user_id selected_start_date selected_end_date + selected_group_by } @@ -136,7 +147,7 @@ } } # Redirect so we get the dates in pretty mode - ad_returnredirect ".?[export_vars $filter_var_list]" + ad_returnredirect ".?[export_vars -no_empty $filter_var_list]" ad_script_abort } @@ -150,7 +161,7 @@ ########### if { [exists_and_not_null selected_project_id] } { - set all_projects_url ".?[export_vars -exclude { selected_project_id } $filter_var_list]" + set all_projects_url ".?[export_vars -no_empty -exclude { selected_project_id } $filter_var_list]" } else { set all_projects_url {} } @@ -161,8 +172,8 @@ db_multirow -extend { filter_name url entry_add_url selected_p clear_url start_date end_date } filters select_projects {} { set filter_name "Projects" - set url ".?[export_vars -override { { selected_project_id $unique_id } } $filter_var_list]" - set entry_add_url "log?[export_vars { { project_id $unique_id } {variable_id $selected_variable_id}}]" + set url ".?[export_vars -no_empty -override { { selected_project_id $unique_id } } $filter_var_list]" + set entry_add_url "log?[export_vars -no_empty { { project_id $unique_id } {variable_id $selected_variable_id}}]" set selected_p [string equal $selected_project_id $unique_id] set name [string_truncate -len 25 $name] set clear_url $all_projects_url @@ -207,10 +218,10 @@ db_multirow -append -extend { filter_name url entry_add_url selected_p clear_url start_date end_date } filters select_variables {} { set filter_name "Variables" - set url ".?[export_vars -override { {selected_variable_id $unique_id} } $filter_var_list]" + set url ".?[export_vars -no_empty -override { {selected_variable_id $unique_id} } $filter_var_list]" if { ![empty_string_p $selected_project_id] } { # A project is selected - enable logging - set entry_add_url "log?[export_vars { { variable_id $unique_id } {project_id $selected_project_id}}]" + set entry_add_url "log?[export_vars -no_empty { { variable_id $unique_id } {project_id $selected_project_id}}]" } else { # No project selected - we wont enable those url:s set entry_add_url "" @@ -226,7 +237,7 @@ ########### if { [exists_and_not_null selected_user_id] } { - set all_users_url ".?[export_vars -exclude { selected_user_id } $filter_var_list]" + set all_users_url ".?[export_vars -no_empty -exclude { selected_user_id } $filter_var_list]" } else { set all_users_url {} } @@ -248,7 +259,7 @@ db_multirow -append -extend { filter_name url entry_add_url selected_p clear_url start_date end_date } filters select_users {} { set filter_name "Users" - set url ".?[export_vars -override { {selected_user_id $unique_id} } $filter_var_list]" + set url ".?[export_vars -no_empty -override { {selected_user_id $unique_id} } $filter_var_list]" set entry_add_url {} set selected_p [string equal $selected_user_id $unique_id] set clear_url $all_users_url @@ -264,15 +275,15 @@ if { ![empty_string_p $selected_project_id] && ![empty_string_p $selected_variable_id] } { if { [exists_and_not_null selected_projection_id] } { - set clear_projections_url ".?[export_vars -exclude { selected_projection_id } $filter_var_list]" + set clear_projections_url ".?[export_vars -no_empty -exclude { selected_projection_id } $filter_var_list]" } else { set clear_projections_url {} } db_multirow -append -extend { filter_name url entry_add_url selected_p clear_url } filters select_projections {} { set filter_name "Projections" set name [string_truncate -len 25 $name] - set url ".?[export_vars -override { {selected_projection_id $unique_id} { selected_start_date $start_date } { selected_end_date $end_date } } $filter_var_list]" + set url ".?[export_vars -no_empty -override { {selected_projection_id $unique_id} { selected_start_date $start_date } { selected_end_date $end_date } } $filter_var_list]" set entry_add_url {} set selected_p [string equal $selected_projection_id $unique_id] set clear_url $clear_projections_url @@ -287,7 +298,7 @@ ##### if { [exists_and_not_null selected_start_date] || [exists_and_not_null selected_end_date] } { - set date_clear_url ".?[export_vars -exclude { selected_start_date selected_end_date } $filter_var_list]" + set date_clear_url ".?[export_vars -no_empty -exclude { selected_start_date selected_end_date } $filter_var_list]" } else { set date_clear_url {} } @@ -299,8 +310,18 @@ set weekdayno [clock format [clock seconds] -format %w] set monthdayno [string trimleft [clock format [clock seconds] -format %d] 0] -foreach type { this_week last_week past_7 this_month last_month past_30 } { +foreach type { today yesterday this_week last_week past_7 this_month last_month past_30 } { switch $type { + today { + set name "Today" + set new_start_date [clock format [clock seconds] -format "%Y-%m-%d"] + set new_end_date [clock format [clock seconds] -format "%Y-%m-%d"] + } + yesterday { + set name "Yesterday" + set new_start_date [clock format [clock scan "-1 days"] -format "%Y-%m-%d"] + set new_end_date [clock format [clock scan "-1 days"] -format "%Y-%m-%d"] + } this_week { set name "This week" set new_start_date [clock format [clock scan "-$weekdayno days"] -format "%Y-%m-%d"] @@ -333,7 +354,7 @@ } } - set url ".?[export_vars -override { { selected_start_date $new_start_date } { selected_end_date $new_end_date }} $filter_var_list]" + set url ".?[export_vars -no_empty -override { { selected_start_date $new_start_date } { selected_end_date $new_end_date }} $filter_var_list]" set selected_p [expr [string equal $selected_start_date $new_start_date] && [string equal $selected_end_date $new_end_date]] @@ -346,5 +367,37 @@ # Custom if { $custom_p } { + # unique_id name filter_name url entry_add_url selected_p clear_url multirow append filters "" "Custom range" $filter_name "" "" $custom_p $date_clear_url {} {} } + +##### +# +# Group by filter +# +##### + +# TODO: +# Flag to export_vars -no_empty which doesn't export empty strings + +if { [exists_and_not_null selected_group_by] } { + set group_clear_url ".?[export_vars -no_empty -exclude { selected_group_by } $filter_var_list]" +} else { + set group_clear_url {} +} + +array set group_label { + time_stamp "Day" + time_stamp_week "Week" + project_name "Project" + user_id "User" +} + +foreach unique_id { time_stamp_week time_stamp project_name user_id } { + set url ".?[export_vars -no_empty -override { { selected_group_by $unique_id } } $filter_var_list]" + + set selected_p [string equal $selected_group_by $unique_id] + + # unique_id name filter_name url entry_add_url selected_p clear_url + multirow append filters $unique_id $group_label($unique_id) "Group by" $url "" $selected_p $group_clear_url +} Index: openacs-4/packages/logger/www/log.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/log.adp,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/logger/www/log.adp 22 May 2003 15:01:52 -0000 1.8 +++ openacs-4/packages/logger/www/log.adp 28 Aug 2003 09:45:30 -0000 1.9 @@ -53,12 +53,19 @@ -

      Log history for the past @log_history_n_days@ days

      +

      Log history (@start_date_ansi@ to @end_date_ansi@)

      +

      + The log history is + shown @log_history_n_days@ days back from your last logged entry, or @log_history_n_days@ days back from + today if you have no previously logged entries. +

      +
      Index: openacs-4/packages/logger/www/log.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/log.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/logger/www/log.tcl 9 May 2003 15:07:48 -0000 1.9 +++ openacs-4/packages/logger/www/log.tcl 28 Aug 2003 09:45:30 -0000 1.10 @@ -8,6 +8,8 @@ entry_id:integer,optional project_id:integer,optional variable_id:integer,optional + {edit:boolean "f"} + {return_url "."} } -validate { project_id_required_in_add_mode { # For the sake of simplicity of the form @@ -29,41 +31,10 @@ if { [string equal [form get_action log_entry_form] "done"] } { # User is done editing - redirect back to index page - ad_returnredirect . + ad_returnredirect $return_url ad_script_abort } -# Different page title and form mode when adding a log entry -# versus displaying/editing one -if { [exists_and_not_null entry_id] } { - # Initial request in display or edit mode or a submit of the form - set page_title "Edit Log Entry" - set ad_form_mode edit -} else { - # Initial request in add mode - set page_title "Add Log Entry" - set ad_form_mode edit -} - -set context [list $page_title] - -# Build the log entry form elements -set actions [list] -if { $entry_exists_p && [permission::permission_p -object_id $entry_id -privilege write] } { - lappend actions { Edit formbuilder::edit } -} -lappend actions { Done done } - -ad_form -name log_entry_form -cancel_url index -mode $ad_form_mode \ - -actions $actions -form { - entry_id:key(acs_object_id_seq) -} - -# On various occasions we need to know if we are dealing with a submit with the -# form or an initial request (could also be with error message after unaccepted submit) -set submit_p [form is_valid log_entry_form] - - ########### # # Get project and variable info @@ -102,6 +73,49 @@ # ########### +# The creator of a log entry can always edit it +if { $entry_exists_p } { + set edit_p [expr [permission::permission_p -object_id $entry_id -privilege write] || \ + $current_user_id == $entry_array(creation_user)] +} else { + set edit_p 0 +} + +# Different page title and form mode when adding a log entry +# versus displaying/editing one +if { [exists_and_not_null entry_id] } { + # Initial request in display or edit mode or a submit of the form + set page_title "Edit Log Entry" + if { [string equal $edit "t"] && $edit_p } { + set ad_form_mode edit + } else { + set ad_form_mode display + } +} else { + # Initial request in add mode + set page_title "Add Log Entry" + set ad_form_mode edit +} + +set context [list $page_title] + + +# Build the log entry form elements +set actions [list] +if { $edit_p } { + lappend actions { Edit formbuilder::edit } +} +lappend actions { Done done } + +ad_form -name log_entry_form -cancel_url $return_url -mode $ad_form_mode \ + -actions $actions -form { + entry_id:key(acs_object_id_seq) +} + +# On various occasions we need to know if we are dealing with a submit with the +# form or an initial request (could also be with error message after unaccepted submit) +set submit_p [form is_valid log_entry_form] + ad_form -extend -name log_entry_form -form { {project:text(inform) {label Project} @@ -115,6 +129,8 @@ {variable_id:integer(hidden) {value $variable_id} } + + {return_url:text(hidden) {value $return_url}} } # Add form elements common to all modes @@ -194,8 +210,7 @@ -time_stamp $time_stamp_ansi \ -description $description } -after_submit { - - ad_returnredirect "[ad_conn url]?[export_vars { project_id variable_id }]" + ad_returnredirect "[ad_conn url]?[export_vars { project_id variable_id return_url }]" ad_script_abort } @@ -215,12 +230,41 @@ set show_log_history_p [expr $entry_edited_by_owner_p || ! $entry_exists_p] -set log_history_n_days 31 -set seconds_per_day [expr 60*60*24] -set start_date_seconds [expr [clock seconds] - $log_history_n_days * $seconds_per_day] -set start_date_ansi [clock format $start_date_seconds \ - -format "%Y-%m-%d"] +if { $show_log_history_p } { + # Show N number of days previous to the last logged entry by the user + set ansi_format_string "%Y-%m-%d" + set last_logged_date [db_string last_logged_date { + select to_char(le.time_stamp, 'YYYY-MM-DD') + from logger_entries le, + acs_objects ao + where le.entry_id = ao.object_id + and le.variable_id = :variable_id + and le.project_id = :project_id + and ao.creation_user = :current_user_id + and ao.creation_date = (select max(ao.creation_date) + from logger_entries le, + acs_objects ao + where le.entry_id = ao.object_id + and le.variable_id = :variable_id + and le.project_id = :project_id + and ao.creation_user = :current_user_id + ) + } -default ""] + if { ![empty_string_p $last_logged_date] } { + set end_date_ansi $last_logged_date + set end_date_seconds [clock scan $end_date_ansi] + } else { + # Default end date to now + set end_date_seconds [clock seconds] + set end_date_ansi [clock format $end_date_seconds -format $ansi_format_string] + } + set log_history_n_days 31 + set seconds_per_day [expr 60*60*24] + set start_date_seconds [expr $end_date_seconds - $log_history_n_days * $seconds_per_day] + set start_date_ansi [clock format $start_date_seconds \ + -format $ansi_format_string] +} set add_entry_url "log?[export_vars { project_id variable_id }]" Index: openacs-4/packages/logger/www/admin/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/index-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/logger/www/admin/index-oracle.xql 8 May 2003 13:56:04 -0000 1.2 +++ openacs-4/packages/logger/www/admin/index-oracle.xql 28 Aug 2003 09:45:31 -0000 1.3 @@ -39,6 +39,7 @@ ) or lv.package_id = :package_id or lv.package_id is null) + order by lv.name @@ -52,6 +53,7 @@ where ppm.project_id = p.project_id and ppm.package_id = :package_id) and acs_permission.permission_p(p.project_id, :user_id, 'read') = 't' + order by p.name Index: openacs-4/packages/logger/www/admin/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/index-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/logger/www/admin/index-postgresql.xql 8 May 2003 13:56:04 -0000 1.2 +++ openacs-4/packages/logger/www/admin/index-postgresql.xql 28 Aug 2003 09:45:31 -0000 1.3 @@ -39,6 +39,7 @@ ) or lv.package_id = :package_id or lv.package_id is null) + order by lv.name @@ -52,6 +53,7 @@ where ppm.project_id = p.project_id and ppm.package_id = :package_id) and acs_permission__permission_p(p.project_id, :user_id, 'read') = 't' + order by p.name Index: openacs-4/packages/logger/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/index.adp,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/logger/www/admin/index.adp 22 May 2003 15:02:07 -0000 1.9 +++ openacs-4/packages/logger/www/admin/index.adp 28 Aug 2003 09:45:31 -0000 1.10 @@ -33,7 +33,7 @@ - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -88,15 +196,16 @@ - - - - - - - - - + + + + + + + + + +
      @projects.name@ YesNo Yes (toggle)No (toggle) @projects.project_lead_chunk@ Index: openacs-4/packages/logger/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/index.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/logger/www/admin/index.tcl 8 May 2003 13:56:04 -0000 1.6 +++ openacs-4/packages/logger/www/admin/index.tcl 28 Aug 2003 09:45:31 -0000 1.7 @@ -21,14 +21,19 @@ # ########### -db_multirow -extend { edit_url display_url permissions_url delete_url unmap_url project_lead_chunk } projects select_projects {} { +db_multirow -extend { + edit_url display_url permissions_url delete_url unmap_url project_lead_chunk + make_active_url make_inactive_url +} projects select_projects {} { set description [string_truncate -len 50 $description] set edit_url "project?[export_vars { project_id {formbutton\:formbuilder\:\:edit Edit} {form\:id project_form} {form\:mode display}}]" set display_url "project?[export_vars { project_id }]" set unmap_url "project-instance-map?[export_vars { project_id {unmap "t"} }]" set permissions_url "${permissions_uri}?[export_vars {{object_id $project_id} application_url}]" set delete_url "project-delete?[export_vars { project_id }]" + set make_active_url "project-make-active?[export_vars { project_id }]" + set make_inactive_url "project-make-inactive?[export_vars { project_id }]" set project_lead_chunk [ad_present_user $project_lead_id $project_lead_name] } Index: openacs-4/packages/logger/www/admin/project-make-active.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project-make-active.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/logger/www/admin/project-make-active.tcl 28 Aug 2003 09:45:31 -0000 1.2 @@ -0,0 +1,16 @@ +ad_page_contract { + Make project active. +} { + project_id:integer,multiple,optional +} + +db_transaction { + foreach id $project_id { + logger::project::set_active_p \ + -project_id $id \ + -active_p t + } +} + +ad_returnredirect . + Index: openacs-4/packages/logger/www/admin/project-make-inactive.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project-make-inactive.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/logger/www/admin/project-make-inactive.tcl 28 Aug 2003 09:45:31 -0000 1.2 @@ -0,0 +1,16 @@ +ad_page_contract { + Make project inactive. +} { + project_id:integer,multiple,optional +} + +db_transaction { + foreach id $project_id { + logger::project::set_active_p \ + -project_id $id \ + -active_p f + } +} + +ad_returnredirect . + Index: openacs-4/packages/logger/www/admin/project.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/logger/www/admin/project.tcl 8 May 2003 13:56:04 -0000 1.9 +++ openacs-4/packages/logger/www/admin/project.tcl 28 Aug 2003 09:45:31 -0000 1.10 @@ -57,11 +57,31 @@ {html {cols 60 rows 13}} {label "Description"} } -} -select_query { - select name, - description - from logger_projects - where project_id = :project_id + + {project_lead:search + {result_datatype integer} + {label {Project Lead}} + {options [logger::project::users_get_options]} + {search_query {[db_map dbqd.acs-tcl.tcl.community-core-procs.user_search]}} + } +} + +if { ![ad_form_new_p -key project_id] } { + ad_form -extend -name project_form -form { + {active_p:text(radio) + {label "Active"} + {options {{Yes t} {No f}}} + } + } +} + +ad_form -extend -name project_form -select_query { + select name, + description, + project_lead, + active_p + from logger_projects + where project_id = :project_id } -validate { { name @@ -71,19 +91,24 @@ } -new_data { - logger::project::new -project_id $project_id \ - -name $name \ - -description $description \ + logger::project::new \ + -project_id $project_id \ + -name $name \ + -description $description \ + -project_lead $project_lead + } -edit_data { # The edit proc requires all attributes to be provided # so use the old values for project_lead and active_p - logger::project::get -project_id $project_id -array old_project - logger::project::edit -project_id $project_id \ - -name $name \ - -description $description \ - -project_lead $old_project(project_lead) \ - -active_p $old_project(active_p) + + logger::project::edit \ + -project_id $project_id \ + -name $name \ + -description $description \ + -project_lead $project_lead \ + -active_p $active_p + } -after_submit { ad_returnredirect "[ad_conn url]?project_id=$project_id" Index: openacs-4/packages/logger/www/admin/projection.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/projection.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/logger/www/admin/projection.tcl 9 May 2003 15:08:03 -0000 1.4 +++ openacs-4/packages/logger/www/admin/projection.tcl 28 Aug 2003 09:45:31 -0000 1.5 @@ -60,7 +60,6 @@ {variable_id:integer(select) {label Variable} {options {[logger::ui::variable_options -project_id $project_id]}} - {mode display} } {value:text Index: openacs-4/packages/logger/www/lib/entries-table-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/lib/Attic/entries-table-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/logger/www/lib/entries-table-oracle.xql 8 May 2003 13:56:20 -0000 1.1 +++ openacs-4/packages/logger/www/lib/entries-table-oracle.xql 28 Aug 2003 09:45:31 -0000 1.2 @@ -6,9 +6,11 @@ select le.entry_id as id, - acs_permission.permission_p(le.entry_id, :user_id, 'delete') as delete_p, + acs_permission.permission_p(le.entry_id, :current_user_id, 'delete') as delete_p, + acs_permission.permission_p(le.entry_id, :current_user_id, 'write') as edit_p, le.time_stamp, - to_char(le.time_stamp, 'fmMMfm-fmDDfm-YYYY') as time_stamp_pretty, + to_char(le.time_stamp, 'fmDyfm fmMMfm-fmDDfm-YYYY') as time_stamp_pretty, + to_char(le.time_stamp, 'IW-YYYY') as time_stamp_week, le.value, le.description, lp.name as project_name, @@ -22,7 +24,7 @@ and ao.object_id = le.entry_id and ao.creation_user = submitter.user_id [ad_decode $where_clauses "" "" "and [join $where_clauses "\n and "]"] - order by le.time_stamp desc, ao.creation_date desc + order by $order_by Index: openacs-4/packages/logger/www/lib/entries-table-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/lib/Attic/entries-table-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/logger/www/lib/entries-table-postgresql.xql 8 May 2003 13:56:20 -0000 1.1 +++ openacs-4/packages/logger/www/lib/entries-table-postgresql.xql 28 Aug 2003 09:45:31 -0000 1.2 @@ -6,9 +6,11 @@ select le.entry_id as id, - acs_permission__permission_p(le.entry_id, :user_id, 'delete') as delete_p, + acs_permission__permission_p(le.entry_id, :current_user_id, 'delete') as delete_p, + acs_permission__permission_p(le.entry_id, :current_user_id, 'write') as edit_p, le.time_stamp, - to_char(le.time_stamp, 'fmMMfm-fmDDfm-YYYY') as time_stamp_pretty, + to_char(le.time_stamp, 'fmDyfm fmMMfm-fmDDfm-YYYY') as time_stamp_pretty, + to_char(le.time_stamp, 'IW-YYYY') as time_stamp_week, le.value, le.description, lp.name as project_name, @@ -22,7 +24,7 @@ and ao.object_id = le.entry_id and ao.creation_user = submitter.user_id [ad_decode $where_clauses "" "" "and [join $where_clauses "\n and "]"] - order by le.time_stamp desc, ao.creation_date desc + order by $order_by Index: openacs-4/packages/logger/www/lib/entries-table.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/lib/Attic/entries-table.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/logger/www/lib/entries-table.adp 8 May 2003 13:56:20 -0000 1.4 +++ openacs-4/packages/logger/www/lib/entries-table.adp 28 Aug 2003 09:45:31 -0000 1.5 @@ -14,37 +14,140 @@ Description  
      +   +
      + + + User: @entries.user_chunk@ + + + Project: @entries.project_name@ + + + Date: @entries.time_stamp_pretty@ + + + Week: @entries.time_stamp_week@ + + + Unknown group by column @group_by@ + + +
      + + Edit + + @entries.project_name@@entries.user_chunk@@entries.time_stamp_pretty@ + @entries.value@ + + @entries.description@ + + + Delete + +
        + + Subtotal + + + Subtotal Average + + + + @entries.subtotal@ + + + @entries.subaverage@ + +   
      - Edit - @entries.project_name@@entries.user_chunk@@entries.time_stamp_pretty@ - @entries.value@ - @entries.description@ - - Delete + +
      + + Edit + + @entries.project_name@@entries.user_chunk@@entries.time_stamp_pretty@ + + @entries.value@ + + + @entries.value@ + + + @entries.description@ + + + Delete + +
      +   +
        @@ -79,6 +182,11 @@ +
      +   +
        Projection
          @variable.unit@  
          @variable.unit@  
      Index: openacs-4/packages/logger/www/lib/entries-table.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/lib/Attic/entries-table.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/logger/www/lib/entries-table.tcl 9 May 2003 11:05:02 -0000 1.5 +++ openacs-4/packages/logger/www/lib/entries-table.tcl 28 Aug 2003 09:45:31 -0000 1.6 @@ -8,8 +8,9 @@ # start_date_ansi # end_date_ansi # projection_value +# group_by:optional -set user_id [ad_conn user_id] +set current_user_id [ad_conn user_id] set package_id [ad_conn package_id] set where_clauses [list] @@ -48,15 +49,34 @@ set selected_entry_id {} } +set order_by "le.time_stamp desc, ao.creation_date desc" + +# If we're grouping by, we should sort by that column first +if { [exists_and_not_null group_by] } { + switch -exact $group_by { + user_id { + set order_by "user_name asc, $order_by" + } + project_name { + set order_by "project_name asc, $order_by" + } + } +} + set value_total 0 set value_count 0 -db_multirow -extend { edit_url delete_url delete_onclick user_chunk selected_p } entries select_entries {} { +set last_group_by_value {} +set value_subcount 0 +set value_subtotal 0 + +db_multirow -extend { subtotal subaverage view_url edit_url delete_url delete_onclick user_chunk selected_p } entries select_entries {} { set description [string_truncate -len 50 $description] set project_name [string_truncate -len 20 $project_name] set selected_p [string equal $id $selected_entry_id] set action_links_list [list] - set edit_url "log?[export_vars { { entry_id $id } }]" + set view_url "log?[export_vars { { entry_id $id } }]" + set edit_url "log?[export_vars { { entry_id $id } { edit "t" } }]" if { $delete_p } { set delete_onclick "return confirm('Are you sure you want to delete log entry with $value $variable(unit) $variable(name) on $time_stamp?');" set delete_url "log-delete?[export_vars { { entry_id $id } }]" @@ -66,6 +86,24 @@ set user_chunk [ad_present_user $user_id $user_name] + if { [exists_and_not_null group_by] } { + # Should we reset the subtotal? + if { ![string equal $last_group_by_value [set $group_by]] } { + set value_subtotal 0 + set value_subcount 0 + } + + # Calculate new subtotal/average + set value_subtotal [expr $value_subtotal + $value] + incr value_subcount + + # and store it in the column + set subtotal $value_subtotal + set subaverage [expr round(100.0 * $value_subtotal / $value_subcount) / 100.0] + + set last_group_by_value [set $group_by] + } + set value_total [expr $value_total + $value] incr value_count } Index: openacs-4/packages/monitoring/monitoring.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/monitoring/monitoring.info,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/monitoring/monitoring.info 17 May 2003 10:46:40 -0000 1.6 +++ openacs-4/packages/monitoring/monitoring.info 28 Aug 2003 09:41:57 -0000 1.7 @@ -88,13 +88,13 @@ - + - + Index: openacs-4/packages/monitoring/www/top/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/monitoring/www/top/index-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/monitoring/www/top/index-postgresql.xql 19 Aug 2002 23:10:29 -0000 1.1 +++ openacs-4/packages/monitoring/www/top/index-postgresql.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -14,15 +14,15 @@ - + (24 - (:end_time ::integer - $current_hour ::integer)) / 24 + + (interval '24 hours' - (interval '$end_time hours' - interval '$current_hour hours')) - and (timestamp + :n_days ::integer $hour_correction) > current_timestamp + and (timestamp + interval '$n_days days' $hour_correction) > current_timestamp Index: openacs-4/packages/news/sql/oracle/news-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/sql/oracle/news-create.sql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/news/sql/oracle/news-create.sql 12 Mar 2003 15:43:08 -0000 1.5 +++ openacs-4/packages/news/sql/oracle/news-create.sql 28 Aug 2003 09:41:57 -0000 1.6 @@ -368,14 +368,15 @@ item_id => v_id, name => v_name, parent_id => v_parent_id, + context_id => package_id, locale => locale, item_subtype => item_subtype, content_type => content_type, mime_type => mime_type, nls_language => nls_language, relation_tag => relation_tag, creation_date => creation_date, - creation_ip => creation_ip, + creation_ip => creation_ip, creation_user => creation_user ); v_revision_id := content_revision.new( Index: openacs-4/packages/news/sql/postgresql/news-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/sql/postgresql/news-create.sql,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/news/sql/postgresql/news-create.sql 23 Aug 2003 19:20:32 -0000 1.13 +++ openacs-4/packages/news/sql/postgresql/news-create.sql 28 Aug 2003 09:41:57 -0000 1.14 @@ -270,7 +270,7 @@ p_locale, -- locale current_timestamp, -- creation_date p_creation_user, -- creation_user - null, -- context_id + p_package_id, -- context_id p_creation_ip, -- creation_ip ''content_item'', -- item_subtype ''news'', -- content_type Index: openacs-4/packages/news/tcl/news-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/news/tcl/news-procs.tcl 13 May 2003 08:11:52 -0000 1.8 +++ openacs-4/packages/news/tcl/news-procs.tcl 28 Aug 2003 09:41:57 -0000 1.9 @@ -108,7 +108,7 @@ @author Robert Locke } { - set package_id [db_string get_package_id {*SQL*}] + set package_id [db_string get_package_id {}] set url_stub [news_util_get_url $package_id] db_1row get_item_id " Index: openacs-4/packages/news/www/item.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/item.adp,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/news/www/item.adp 3 Jul 2003 19:39:34 -0000 1.6 +++ openacs-4/packages/news/www/item.adp 28 Aug 2003 09:41:57 -0000 1.7 @@ -19,12 +19,10 @@ @comments@ -
      • @comment_link;noquote@
      -
      Index: openacs-4/packages/news-aggregator/news-aggregator.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/news-aggregator.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/news-aggregator.info 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,49 @@ + + + + + News Aggregator + News Aggregators + f + f + + + + oracle + postgresql + + Simon Carstensen + Read news sources from your website. + 2003-02-02 + The news aggregator periodically reads a set of news sources, in one of several XML-based formats, finds the new bits, and displays them in reverse-chronological order on a single page. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/news-aggregator/sql/oracle/news-aggregator-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/sql/oracle/Attic/news-aggregator-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/sql/oracle/news-aggregator-create.sql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,67 @@ +-- +-- news-aggregator-create.sql +-- +-- @author Simon Carstensen +-- +-- @cvs-id $Id: news-aggregator.sql +-- + +declare +begin + acs_object_type.create_type( + object_type => 'na_source', + pretty_name => 'Source', + pretty_plural => 'Sources', + supertype => 'acs_object', + table_name => 'na_sources', + id_column => 'source_id', + package_name => null, + abstract_p => 'f', + type_extension_table => null, + name_method => 'na_source.title' + ); +end; +/ +show errors + + + +create table na_sources ( + source_id constraint na_sources_source_id_fk + references acs_objects(object_id) + constraint na_sources_source_id_pk + primary key, + package_id constraint na_sources_package_id_fk + references apm_packages(package_id), + owner_id constraint na_sources_owner_id_fk + references users(user_id), + feed_url varchar(100) + constraint na_sources_feed_url_nn + not null, + link varchar(100), + title varchar(100), + description varchar(255), + updates integer, + last_scanned date, + last_modified varchar(30) +); + + + +create table na_items ( + item_id integer constraint na_items_pk + primary key, + source_id constraint na_items_source_id_fk + references na_sources (source_id), + link varchar(255), + title varchar(255), + description clob, + creation_date date, + deleted_p char(1) default '0' +); + + + +create sequence na_items_seq; + +@@ news-aggregator-package-create Index: openacs-4/packages/news-aggregator/sql/oracle/news-aggregator-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/sql/oracle/Attic/news-aggregator-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/sql/oracle/news-aggregator-drop.sql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,28 @@ +-- +-- news-aggregator-drop.sql +-- +-- @author Simon Carstensen +-- +-- @cvs-id $Id: news-aggregator-drop.sql +-- + +begin + + for na_source in (select source_id from na_sources) loop + + na_source.delete(na_source.source_id); + end loop; + + acs_object_type.drop_type( + object_type => 'na_source', + cascade_p => 't' + ); + +end; +/ +show errors + +@@ news-aggregator-package-drop + +drop table na_items; +drop table na_sources; Index: openacs-4/packages/news-aggregator/sql/oracle/news-aggregator-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/sql/oracle/Attic/news-aggregator-package-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/sql/oracle/news-aggregator-package-create.sql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,121 @@ +-- +-- news-aggregator-package-create.sql +-- +-- @author Simon Carstensen +-- +-- @cvs-id $Id: news-aggregator-package-create.sql +-- + +create or replace package na_source +as + + function new ( + source_id in na_sources.source_id%TYPE default null, + package_id in na_sources.package_id%TYPE, + feed_url in na_sources.feed_url%TYPE default null, + link in na_sources.link%TYPE default null, + title in na_sources.title%TYPE default null, + description in na_sources.description%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return na_sources.source_id%TYPE; + + procedure delete ( + source_id in na_sources.source_id%TYPE + ); + + function title ( + source_id in na_sources.source_id%TYPE + ) return na_sources.title%TYPE; + +end na_source; +/ +show errors + +create or replace package body na_source +as + + function new ( + source_id in na_sources.source_id%TYPE default null, + package_id in na_sources.package_id%TYPE, + feed_url in na_sources.feed_url%TYPE default null, + link in na_sources.link%TYPE default null, + title in na_sources.title%TYPE default null, + description in na_sources.description%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null + ) return na_sources.source_id%TYPE + is + v_source_id na_sources.source_id%TYPE; + begin + + v_source_id := acs_object.new( + object_id => na_source.new.source_id, + object_type => 'na_source', + creation_date => sysdate, + creation_user => na_source.new.creation_user, + creation_ip => na_source.new.creation_ip, + context_id => na_source.new.package_id + ); + + insert into na_sources ( + source_id, + package_id, + owner_id, + feed_url, + link, + title, + description, + updates, + last_scanned, + last_modified + ) values ( + v_source_id, + na_source.new.package_id, + na_source.new.creation_user, + na_source.new.feed_url, + na_source.new.link, + na_source.new.title, + na_source.new.description, + '0', + sysdate, + sysdate + ); + + return v_source_id; + + end new; + + procedure delete ( + source_id in na_sources.source_id%TYPE + ) + is + begin + + delete + from na_sources + where source_id = na_source.delete.source_id; + + acs_object.delete(na_source.delete.source_id); + + end delete; + + function title ( + source_id in na_sources.source_id%TYPE + ) return na_sources.title%TYPE + is + v_title na_sources.title%TYPE; + begin + + select title + into v_title + from na_sources + where source_id = na_source.title.source_id; + + return v_title; + + end title; + +end na_source; +/ +show errors Index: openacs-4/packages/news-aggregator/sql/oracle/news-aggregator-package-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/sql/oracle/Attic/news-aggregator-package-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/sql/oracle/news-aggregator-package-drop.sql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,10 @@ +-- +-- news-aggregator-package-drop.sql +-- +-- @author Simon Carstensen +-- +-- @cvs-id $Id: news-aggregator-package-drop.sql +-- + +drop package body na_source; +drop package na_source; Index: openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-create.sql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,192 @@ + +select acs_object_type__create_type ( + 'na_source', -- object_type + 'Sources', -- pretty_name + 'Sources', -- pretty_plural + 'acs_object', -- supertype + 'na_sources', -- table_name + 'source_id', -- id_column + null, -- package_name + 'f', -- abstract_p + null, -- type_extension_table + 'na_source.title' -- name_method +); + + +create table na_sources ( + source_id integer + constraint na_sources_source_id_fk + references acs_objects(object_id) + constraint na_sources_source_id_pk + primary key, + package_id integer + constraint na_sources_package_id_fk + references apm_packages(package_id), + owner_id integer + constraint na_sources_owner_id_fk + references users(user_id), + feed_url varchar(100) + constraint na_sources_feed_url_nn + not null, + link varchar(100), + title varchar(100), + description varchar(255), + updates integer, + last_scanned timestamp, + last_modified varchar(30) +); + +create table na_items ( + item_id integer + default nextval('na_items_item_id_seq') + primary key, + source_id integer + constraint na_items_source_id_fk + references na_sources (source_id), + link varchar(255), + title varchar(255), + description text, + creation_date timestamp, + deleted_p boolean +); + +create sequence na_items_item_id_seq; + +create or replace function na_source__new ( + integer, -- source_id + integer, -- package_id + integer, -- owner_id + varchar, -- feed_url + varchar, -- link + varchar, -- title + varchar, -- description + integer, -- updates + timestamp, -- last_scanned + varchar, -- last_modified + varchar, -- object_type + integer, -- creation_user + varchar -- creation_ip +) returns integer as ' +declare + p_source_id alias for $1; + p_package_id alias for $2; + p_owner_id alias for $3; + p_feed_url alias for $4; + p_link alias for $5; + p_title alias for $6; + p_description alias for $7; + p_updates alias for $8; + p_last_scanned alias for $9; + p_last_modified alias for $10; + p_object_type alias for $11; + p_creation_user alias for $12; + p_creation_ip alias for $13; + v_source_id integer; +begin + v_source_id := acs_object__new ( + p_source_id, + p_object_type, + current_timestamp, + p_creation_user, + p_creation_ip, + p_package_id + ); + + insert into na_sources ( + source_id, + package_id, + owner_id, + feed_url, + link, + title, + description, + updates, + last_scanned, + last_modified + ) values ( + v_source_id, + p_package_id, + p_owner_id, + p_feed_url, + p_link, + p_title, + p_description, + p_updates, + p_last_scanned, + p_last_modified + ); + + PERFORM acs_permission__grant_permission( + v_source_id, + p_owner_id, + ''admin'' + ); + + return v_source_id; + +end;' language 'plpgsql'; + +create or replace function na_source__delete ( + integer -- source_id +) +returns integer as ' +declare + p_source_id alias for $1; +begin + + delete from na_items + where source_id = p_source_id; + + delete from acs_permissions + where object_id = p_source_id; + + delete from na_sources + where source_id = p_source_id; + + raise NOTICE ''Deleting na_source and its belonging items...''; + PERFORM acs_object__delete(p_source_id); + + return 0; + +end;' language 'plpgsql'; + +create or replace function na_item__new ( + integer, -- source_id + varchar, -- link + varchar, -- title + varchar, -- description + timestamp, -- creation_date + boolean -- deleted_p +) returns integer as ' +declare + p_source_id alias for $1; + p_link alias for $2; + p_title alias for $3; + p_description alias for $4; + p_creation_date alias for $5; + p_deleted_p alias for $6; +begin + + insert into na_items + (source_id, link, title, description, creation_date, deleted_p) + values + (p_source_id, p_link, p_title, p_description, p_creation_date, p_deleted_p); + + return 1; + +end;' language 'plpgsql'; + +create or replace function na_source__title (integer) +returns varchar as ' +declare + p_source_id alias for $1; + v_source_title na_sources.title%TYPE; +begin + select title + into v_source_title + from na_sources + where source_id = p_source_id; + + return v_source_title; +end; +' language 'plpgsql'; Index: openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/sql/postgresql/news-aggregator-drop.sql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,39 @@ +--drop na_item functions +drop function na_item__new (integer,varchar,varchar,varchar,timestamp,boolean); + +--drop na_item table +drop table na_items; +drop sequence na_items_item_id_seq; + +--drop na_source functions +drop function na_source__new (integer,integer,integer,varchar,varchar,varchar,varchar,integer,timestamp,varchar,varchar,integer,varchar); +drop function na_source__delete (integer); +drop function na_source__title (integer); + +delete from acs_permissions where object_id in (select source_id from na_sources); + +--drop na_source objects +create function inline_0 () +returns integer as ' +declare + object_rec record; +begin + for object_rec in select object_id from acs_objects where object_type=''na_source'' + loop + perform acs_object__delete( object_rec.object_id ); + end loop; + + return 0; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + +--drop na_source table +drop table na_sources; + +--drop na_source type +select acs_object_type__drop_type( + 'na_source', + 't' + ); Index: openacs-4/packages/news-aggregator/tcl/news-aggregator-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/Attic/news-aggregator-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/tcl/news-aggregator-procs-oracle.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,59 @@ + + + + oracle8.1.6 + + + + begin + :1 := na_source.new ( + source_id => :source_id, + package_id => :package_id, + feed_url => :feed_url, + link => :link, + title => :title, + description => :description, + creation_user => :owner_id, + creation_ip => :creation_ip + ); + end; + + + + + + begin + :1 := na_source.new ( + source_id => :source_id, + link => :link, + title => :title, + description => :description, + => sysdate, + => '0' + ); + end + + + + + + begin + :1 := na_source.new ( + source_id => :source_id, + link => :link, + title => :title, + description => :description, + => sysdate, + => '0' + ); + end + + + + + + delete from na_items where creation_date + 60 < sysdate + + + + Index: openacs-4/packages/news-aggregator/tcl/news-aggregator-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/Attic/news-aggregator-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/tcl/news-aggregator-procs-postgresql.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,71 @@ + + + + postgresql7.1 + + + + select na_source__new ( + :source_id, + :package_id, + :owner_id, + :feed_url, + :link, + :title, + :description, + '0', + now(), + :last_modified, + 'na_source', + :owner_id, + :creation_ip + ) + + + + + + select na_item__new ( + :source_id, + :link, + :title, + :description, + now(), + '0' + ); + + + + + + select na_item__new ( + :source_id, + :link, + :title, + :description, + now(), + '0' + ); + + + + + + delete from na_items where date + interval '2 month' < now() + + + + + + update na_sources + set link = :link, + title = :title, + description = :description, + updates = (updates + 1), + last_scanned = now(), + last_modified = :last_modified + where source_id = :source_id + + + + Index: openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,320 @@ +ad_library { + Procs used by the News Aggregator module. + @author Simon Carstensen (simon@bcuni.net) + @creation-date January 2003 +} + +ad_proc -public util_httpget_full { + url {headers ""} {timeout 30} {depth 0} +} { + Just like ns_httpget, but first optional argument is an ns_set of + headers to send during the fetch. +} { + if {[incr depth] > 10} { + return -code error "util_httpget: Recursive redirection: $url" + } + ns_log "Notice" "Getting {$url} {$headers} {$timeout} {$depth}" + set http [ns_httpopen GET $url $headers $timeout] + set rfd [lindex $http 0] + close [lindex $http 1] + set headers [lindex $http 2] + set response [ns_set name $headers] + set status [lindex $response 1] + set last_modified [ns_set iget $headers last-modified] + if {$status == 302} { + set location [ns_set iget $headers location] + if {$location != ""} { + ns_set free $headers + close $rfd + return [util_httpget_full $location {} $timeout $depth] + } + } elseif { $status == 304 } { + # The requested variant has not been modified since the time specified + # A conditional get didn't return anything. + ns_set free $headers + close $rfd + return [list "" $status] + } + set length [ns_set iget $headers content-length] + if [string match "" $length] {set length -1} + set err [catch { + while 1 { + set buf [_ns_http_read $timeout $rfd $length] + append page $buf + if [string match "" $buf] break + if {$length > 0} { + incr length -[string length $buf] + if {$length <= 0} break + } + } + } errMsg] + ns_set free $headers + close $rfd + if $err { + global errorInfo + return -code error -errorinfo $errorInfo $errMsg + } + return [list $page $status $last_modified] + } + +ad_proc -public na_check_link { + domain + link +} { + regexp {(https?://[^/]+)+} $domain domain + regexp {(https?://[^/]+)+} $link link + return [string equal $link $domain] +} + +ad_proc -public na_last_scanned { + diff +} { + if {$diff < 120 && $diff > 60} { + set to_return "1 hour and " + } elseif {$diff >= 60} { + set to_return "[expr $diff / 60] hours and " + } + set mins [expr $diff % 60] + if {[string equal 1 $mins]} { + append to_return "1 minute ago" + } else { + append to_return "$mins minutes ago" + } + return $to_return +} + +proc ns_xml_getChildrenTrim node { + + set children_list [ns_xml node children $node] + + set new_children {} + foreach child $children_list { + + + if {[ns_xml node type $child] == "cdata_section" && ![string length [string trim [ns_xml node getcontent $child]]]} { + + + } else { + lappend new_children $child + } + } + + return $new_children +} + +proc ns_xml_firstChild node { + return [lindex [ns_xml_getChildrenTrim $node] 0 ] +} + +ad_proc -public na_get_elements { + nodes + match +} { + set matches [list] + foreach node_id $nodes { + if { [string equal $match [ns_xml node name $node_id]] } { + lappend matches $node_id + } else { + set children [ns_xml node children $node_id] + if { [llength $children] > 0 } { + set matches [concat $matches [na_get_elements $children $match]] + } + } + } + return $matches +} + +ad_proc -public na_get_nodes { + nodes +} { + foreach node_id $nodes { + switch -- [ns_xml node name $node_id] { + title { + catch {set title [ns_xml node getcontent [ns_xml_firstChild $node_id]]} + } + link { + catch {set link [ns_xml node getcontent [ns_xml_firstChild $node_id]]} + } + guid { + catch {set guid [ns_xml node getcontent [ns_xml_firstChild $node_id]]} + } + description { + catch {set description [ns_xml node getcontent [ns_xml_firstChild $node_id]]} + } + } + + } + + if { ![exists_and_not_null title] } { + set title "" + } + if { ![exists_and_not_null link] } { + if { [exists_and_not_null guid] } { + set link $guid + } else { + set link "" + } + } + if { ![exists_and_not_null description] } { + set description "" + } + + return [list $title $link $description] +} + +ad_proc -public na_sort_result { + result +} { + set sorted [list] + for {set i 0} {$i < [llength $result]} {incr i} { + lappend sorted [lindex $result end-$i] + } + return $sorted +} + +ad_proc -public na_parse { + xml +} { + if { [catch { + set doc_id [ns_xml parse $xml] + set nodes [ns_xml node children [ns_xml doc root $doc_id]] + set channel [na_get_elements $nodes "channel"] + set result [list [na_get_nodes [ns_xml node children $channel]]] + + set items [na_get_elements $nodes "item"] + set items_sorted [na_sort_result $items] + foreach item $items_sorted { + lappend result [na_get_nodes [ns_xml node children $item]] + } + + } err] } { + ns_log "Notice" "Error parsing RSS feed: $err" + return 0 + } else { + return $result + } +} + +ad_proc -public na_add_source { + feed_url + owner_id + package_id + source_id +} { + Parse $feed_url for host_url, title, and description. Then add the source. +} { + if { ![catch {set f [util_httpget_full $feed_url]}] && [string equal 200 [lindex $f 1]] } { + set result [na_parse [lindex $f 0]] + if { ![string equal 0 $result] } { + + set channel [lindex $result 0] + set title [string_truncate -len 245 -no_format [lindex $channel 0]] + set link [string_truncate -len 245 -no_format [lindex $channel 1]] + set description [string_truncate -len 245 -no_format [lindex $channel 2]] + set source_id [db_nextval "acs_object_id_seq"] + set creation_ip [ns_conn peeraddr] + set last_modified [lindex $f 2] + + # check whether the source already exists + if { ![db_0or1row source { *SQL* }] } { + db_exec_plsql add_source { *SQL* } + set items [lrange $result 1 end] + foreach item $items { + set title [string_truncate -len 245 -no_format [lindex $item 0]] + set link [string_truncate -len 245 -no_format [lindex $item 1]] + set description [lindex $item 2] + db_exec_plsql add_item { *SQL* } + } + } + } + } +} + +ad_proc -public na_update_source { + owner_id + source_id + feed_url + last_modified +} { + Parse source and then update the source if it has changed. +} { + set header [ns_set create] + ns_set put $header "If-Modified-Since" $last_modified + if { [catch { + set f [util_httpget_full $feed_url $header] }] + } { + return + } + # check the http status code + if { [exists_and_not_null f] && [string equal 200 [lindex $f 1]] } { + + set result [na_parse [lindex $f 0]] + set host [lindex [lindex $result 0] 1] + set items [lrange $result 1 end] + foreach item $items { + set title [string_truncate -len 245 -no_format [lindex $item 0]] + set link [string_truncate -len 245 -no_format [lindex $item 1]] + set description [lindex $item 2] + + # check whether link and description have been set as we + # need these to check against already added items + # also we check whether link is an external or internal URL + # if not, it might occur in other items, and we can't check against it + if { [exists_and_not_null link] && [na_check_link $link $host] } { + set identifier "link" + } elseif { [exists_and_not_null description] } { + set identifier "description" + } else { + set identifier "none" + } + + # check whether the item already exists + # that it has at least a link or description + # and that we're not handling a deleted item + + if { ![string equal "none" $identifier] } { + if {![db_0or1row item { *SQL* }]} { + db_exec_plsql add_item { *SQL* } + set updated_p 1 + } elseif { [string equal f $deleted_p] && ((![string equal $title $item_title]) || (![string equal $description $item_description])) } { + db_dml update_item { *SQL* } + set updated_p 1 + } + } + } + if { [exists_and_not_null updated_p] } { + # one or more items were added/updated + # let's update the rss metadata as well + set channel [lindex $result 0] + set last_modified [lindex $f 2] + set title [string_truncate -len 245 -no_format [lindex $channel 0]] + set link [string_truncate -len 245 -no_format [lindex $channel 1]] + set description [string_truncate -len 245 -no_format [lindex $channel 2]] + + db_dml update_source { *SQL* } + } + } +} + +ad_proc -public na_update_sources { } { + Update sources by a one hour interval. +} { + ns_log "Notice" "Updating na_sources" + + db_foreach sources { *SQL* } { + na_update_source $owner_id $source_id $feed_url $last_modified + } + +} + +# schedule hourly updates +ad_schedule_proc 600 na_update_sources + +ad_proc -public na_cleanup_items {} { + Clean up the items that have been retrieved more than two months ago. +} { + db_dml deleted_items { *SQL* } +} + +# schedule daily cleanup of one-week-old deleted items +#ad_schedule_proc 86400 na_cleanup_items Index: openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/Attic/news-aggregator-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,57 @@ + + + + + + + select source_id, + owner_id, + feed_url, + last_modified + from na_sources + + + + + + update na_items + set link = :link, + title = :title, + description = :description, + creation_date = now() + where item_id = :item_id + + + + + + select 1 from na_sources where owner_id = :owner_id AND feed_url =:feed_url + + + + + + select deleted_p, item_id, i.title as item_title, i.description as item_description + from na_sources s, na_items i + where owner_id = :owner_id + and s.source_id = i.source_id + and i.$identifier = :$identifier + and feed_url = :feed_url + order by item_id + + + + + + update na_sources + set link = :link, + title = :title, + description = :description, + updates = (updates + 1), + last_scanned = sysdate, + last_modified = :last_modified + where source_id = :source_id + + + + Index: openacs-4/packages/news-aggregator/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/index-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/index-oracle.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,27 @@ + + + + oracle8.1.6 + + + + select s.source_id, + s.link, + s.description, + s.title, + to_char(creation_date, 'YYYY-MM-DD HH24:MI:SS') as last_scanned, + to_char(creation_date, 'YYYY-MM-DD HH24') as sort_date, + feed_url, + item_id, + i.title as item_title, + i.link as item_link, + i.description as item_description + from na_sources s, na_items i + where owner_id = :user_id AND deleted_p = '0' + and s.source_id = i.source_id + and rownum <= $limit + order by creation_date desc + + + + Index: openacs-4/packages/news-aggregator/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/index-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/index-postgresql.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,27 @@ + + + + postgresql7.1 + + + + select s.source_id, + s.link, + s.description, + s.title, + to_char(creation_date, 'YYYY-MM-DD HH24:MI:SS') as last_scanned, + to_char(creation_date, 'YYYY-MM-DD HH24') as sort_date, + feed_url, + item_id, + i.title as item_title, + i.link as item_link, + i.description as item_description + from na_sources s, na_items i + where owner_id = :user_id AND deleted_p = '0' + and s.source_id = i.source_id + order by creation_date desc + limit $limit + + + + Index: openacs-4/packages/news-aggregator/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/index.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/index.adp 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,78 @@ + + +News Aggregator + +@context_bar@ + +
      + + + + + + + + + +
      + +
      + +
      + + This page lists the most recent items from the feeds you've subscribed to. + + + Click on the Post button to post an item to your weblog. + + + You can delete stories from this page by checking the items that you want to delete and then clicking + the Delete button. + +

      + + + No feeds. + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + +
       @items.title@, @items.diff@, updateRSS
      + @items.content@ + + # + + + G + +  
      +
      +
      +
      +
      + +

      Index: openacs-4/packages/news-aggregator/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/index.tcl 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,53 @@ +#packages/news-aggregator/index.tcl +ad_page_contract { + The News Aggregator index page. + + @author Simon Carstensen simon@bcuni.net + @creation-date Jan 2004 +} { + item_id:integer,notnull,optional,multiple +} -properties { + context_bar:onevalue +} + +ad_maybe_redirect_for_registration + +set user_id [ad_conn user_id] + +set context_bar [ad_context_bar] + +if { ![empty_string_p [ad_parameter "blogger_url"]] } { + set blogger_url "/[ad_parameter "blogger_url"]/entry-edit" +} + +ad_form -name items -form { + {delete_submit:text(submit) {label "Delete" } } +} -on_submit { + if {[exists_and_not_null item_id]} { + foreach delete_id $item_id { + db_dml delete_item { *SQL* } + } + } + + ad_returnredirect "." + ad_script_abort +} + +set limit [ad_parameter "number_of_items_shown"] + +db_multirow -extend { content diff update_url } items items { *SQL* } { + + set text_only [util_remove_html_tags $item_description] + + if {[exists_and_not_null item_title] && ![string equal -nocase $item_title $text_only] } { + set content "$item_title. $item_description" + } else { + set content $item_description + } + + set diff [na_last_scanned [expr [expr [clock seconds] - [clock scan $last_scanned]] / 60]] + + set update_url "source-update?[export_vars { user_id source_id feed_url last_scanned}]" +} + +ad_return_template Index: openacs-4/packages/news-aggregator/www/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/index.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/index.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,11 @@ + + + + + + + update na_items set deleted_p = '1' where item_id = :delete_id + + + + Index: openacs-4/packages/news-aggregator/www/source-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/source-update.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/source-update.tcl 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,17 @@ +#packages/news-aggregator/index.tcl +ad_page_contract { + Update a source. + + @author Simon Carstensen simon@bcuni.net + @creation-date May 2004 +} { + user_id + source_id + feed_url + last_scanned +} + +na_update_source $user_id $source_id $feed_url $last_scanned + +ad_returnredirect "." +ad_script_abort Index: openacs-4/packages/news-aggregator/www/subscriptions-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/subscriptions-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/subscriptions-oracle.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,15 @@ + + + + oracle8.1.6 + + + + :1 := na_source.delete( + source_id => :delete_id + ); + end; + + + + Index: openacs-4/packages/news-aggregator/www/subscriptions-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/subscriptions-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/subscriptions-postgresql.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,15 @@ + + + + postgresql7.1 + + + + select na_source__delete( + :delete_id + ); + + + + + Index: openacs-4/packages/news-aggregator/www/subscriptions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/subscriptions.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/subscriptions.adp 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,56 @@ + + +Subscriptions + +@context_bar@ + +

      + + + + + +
      + + Enter the URL of an XML news feed you want to subscribe to in the box below, + then click on the Add button. + + + URL: + + + + + The following table lists the XML news feeds you've subscribed to. Included is the name of the + source, linked to its Web page, the time or day it last changed, the number of times it has + changed since you subscribed, and a link to the XML file for the channel. To delete a subscription, + check it and then click on the Unsubscribe button at the bottom of the page. + + + + +
      + + + + +
      + + + + + + + + + + +
      @sources.title@@sources.last_scanned@@sources.updates@RSS
      +
      +
      + + + + +
      +
      Index: openacs-4/packages/news-aggregator/www/subscriptions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/subscriptions.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/subscriptions.tcl 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,59 @@ +#packages/news-aggregator/subscriptions.tcl + +ad_page_contract { + The News Aggregator subscription page. + + @author Simon Carstensen (simon@bcuni.net) + @creation-date Jan 2003 +} { + source_id:integer,notnull,optional,multiple + {feed_url ""} +} -properties { + context_bar:onevalue +} + +ad_maybe_redirect_for_registration + +permission::require_permission \ + -object_id [ad_conn package_id] \ + -privilege write + +set user_id [ad_conn user_id] + +set context_bar [ad_context_bar "Add Subscription"] + +set package_id [ad_conn package_id] + +ad_form -name add_subscription -form { + + new_source_id:key + + {feed_url:text(text) {value "http://"} {label "URL:"} {html { size 55 }}} + {add_submit:text(submit) {label "Add"}} +} -validate { + {feed_url + {[exists_and_not_null feed_url] && ![string equal "http://" $feed_url]} "You must specify a URL." + } +} -new_data { + na_add_source $feed_url $user_id $package_id :key + ad_returnredirect "subscriptions" + ad_script_abort +} + +db_multirow sources sources { *SQL* } + +ad_form -name delete_subscription -form { + + {delete_submit:text(submit) {label "Unsubscribe" } } +} -on_submit { + if {[exists_and_not_null source_id]} { + foreach delete_id $source_id { + db_exec_plsql delete_source { *SQL* } + } + } + + ad_returnredirect "subscriptions" + ad_script_abort +} + +ad_return_template Index: openacs-4/packages/news-aggregator/www/subscriptions.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/subscriptions.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/subscriptions.xql 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,20 @@ + + + + + + + select title, + source_id, + feed_url, + link, + description, + updates, + to_char(last_scanned, 'YYYY-MM-DD HH24:MI:SS') as last_scanned + from na_sources + where owner_id = :user_id + order by lower(title) + + + + Index: openacs-4/packages/news-aggregator/www/update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/update.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator/www/update.tcl 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1 @@ +na_update_sources Index: openacs-4/packages/news-aggregator-portlet/news-aggregator-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/news-aggregator-portlet.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/news-aggregator-portlet.info 28 Aug 2003 09:41:57 -0000 1.2 @@ -0,0 +1,27 @@ + + + + + News Aggregator Portlet + News Aggregator Portlets + f + t + + + Simon Carstensen + 2003-05-15 + + + + + + + + + + + + + + + Index: openacs-4/packages/news-aggregator-portlet/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/tcl/apm-callback-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/tcl/apm-callback-procs.tcl 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,212 @@ +ad_library { + Procedures for initializing service contracts etc. for the + news aggregator portlet package. Should only be executed + once upon installation. + + @creation-date 8 May 2003 + @author Simon Carstensen (simon@collaboraid.biz) + @cvs-id $Id: apm-callback-procs.tcl,v 1.2 2003/08/28 09:41:58 lars Exp $ +} + + +namespace eval news_aggregator_portlet {} +namespace eval news_aggregator_admin_portlet {} + +ad_proc -private news_aggregator_portlet::after_install {} { + Create the datasources needed by the news aggregator portlet. +} { + + db_transaction { + set ds_id [portal::datasource_new \ + -name "news_aggregator_portlet" \ + -description "News Aggregator Portlet"] + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shadeable_p \ + -value t + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key hideable_p \ + -value t + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key user_editable_p \ + -value f + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shaded_p \ + -value f + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key link_hideable_p \ + -value f + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p f \ + -key package_id \ + -value "" + + register_portal_datasource_impl + + news_aggregator_admin_portlet::after_install + + } +} + + + +ad_proc -private news_aggregator_portlet::register_portal_datasource_impl {} { + Create the service contracts needed by the news-aggregator portlet. +} { + set spec { + name "news_aggregator_portlet" + contract_name "portal_datasource" + owner "news-aggregator-portlet" + aliases { + GetMyName news_aggregator_portlet::get_my_name + GetPrettyName news_aggregator_portlet::get_pretty_name + Link news_aggregator_portlet::link + AddSelfToPage news_aggregator_portlet::add_self_to_page + Show news_aggregator_portlet::show + Edit news_aggregator_portlet::edit + RemoveSelfFromPage news_aggregator_portlet::remove_self_from_page + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + + + +ad_proc -private news_aggregator_portlet::uninstall {} { + News Aggregator Portlet package uninstall proc +} { + unregister_implementations + + news_aggregator_admin_portlet::unregister_implementations +} + + + +ad_proc -private news_aggregator_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "news_aggregator_portlet" +} + + + +ad_proc -private news_aggregator_admin_portlet::after_install {} { + Create the datasources needed by the news aggregator portlet. +} { + + db_transaction { + set ds_id [portal::datasource_new \ + -name "news_aggregator_admin_portlet" \ + -description "News Aggregator Admin Portlet"] + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shadeable_p \ + -value f + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key hideable_p \ + -value f + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key user_editable_p \ + -value f + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key shaded_p \ + -value f + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p t \ + -key link_hideable_p \ + -value t + + portal::datasource_set_def_param \ + -datasource_id $ds_id \ + -config_required_p t \ + -configured_p f \ + -key package_id \ + -value "" + + register_portal_datasource_impl + } +} + + + +ad_proc -private news_aggregator_admin_portlet::register_portal_datasource_impl {} { + Create the service contracts needed by the news-aggregator admin portlet. +} { + set spec { + name "news_aggregator_admin_portlet" + contract_name "portal_datasource" + owner "news-aggregator-portlet" + aliases { + GetMyName news_aggregator_admin_portlet::get_my_name + GetPrettyName news_aggregator_admin_portlet::get_pretty_name + Link news_aggregator_admin_portlet::link + AddSelfToPage news_aggregator_admin_portlet::add_self_to_page + Show news_aggregator_admin_portlet::show + Edit news_aggregator_admin_portlet::edit + RemoveSelfFromPage news_aggregator_admin_portlet::remove_self_from_page + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + + + +ad_proc -private news_aggregator_admin_portlet::before_uninstall {} { + News Aggregator Portlet package uninstall proc +} { + unregister_implementations +} + + + +ad_proc -private news_aggregator_admin_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "news_aggregator_admin_portlet" +} Index: openacs-4/packages/news-aggregator-portlet/tcl/news-aggregator-admin-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/tcl/news-aggregator-admin-portlet-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/tcl/news-aggregator-admin-portlet-procs.tcl 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,82 @@ +ad_library { + + Procedures to support the news aggregator admin portlet + + @creation-date Mar 2003 + @author simon@bcuni.net + +} + +namespace eval news_aggregator_admin_portlet {} + +ad_proc -private news_aggregator_admin_portlet::get_my_name { +} { + return "news_aggregator_admin_portlet" +} + + + +ad_proc -public news_aggregator_admin_portlet::get_pretty_name { +} { + return "News Aggregator Administration" +} + + + +ad_proc -private news_aggregator_admin_portlet::my_package_key { +} { + return "news-aggregator-portlet" +} + + + +ad_proc -public news_aggregator_admin_portlet::link { +} { + return "" +} + + + +ad_proc -public news_aggregator_admin_portlet::add_self_to_page { + {-portal_id:required} + {-page_name ""} + {-package_id:required} +} { + Adds a news-aggregator admin PE to the given portal + + @param portal_id The page to add self to + @param package_id The package_id of the news-aggregator package + + @return element_id The new element's id +} { + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -key package_id \ + -value $package_id + ] +} + + + +ad_proc -public news_aggregator_admin_portlet::remove_self_from_page { + {-portal_id:required} +} { + Removes a news-aggregator admin PE from the given page +} { + portal::remove_element \ + -portal_id $portal_id \ + -portlet_name [get_my_name] +} + + + +ad_proc -public news_aggregator_admin_portlet::show { + cf +} { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "news-aggregator-admin-portlet" + +} Index: openacs-4/packages/news-aggregator-portlet/tcl/news-aggregator-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/tcl/news-aggregator-portlet-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/tcl/news-aggregator-portlet-procs.tcl 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,92 @@ +ad_library { + + Procedures to support the news-aggregator portlet + + @creation-date Mar 2003 + @author simon@bcuni.net + +} + +namespace eval news_aggregator_portlet {} + + +ad_proc -private news_aggregator_portlet::get_my_name { +} { + return "news_aggregator_portlet" +} + + + +ad_proc -private news_aggregator_portlet::my_package_key { +} { + return "news-aggregator-portlet" +} + + + +ad_proc -public news_aggregator_portlet::get_pretty_name { +} { + return "News Aggregator" +} + + + +ad_proc -public news_aggregator_portlet::link { +} { + return "" +} + + + +ad_proc -public news_aggregator_portlet::add_self_to_page { + {-portal_id:required} + {-package_id:required} + {-param_action:required} +} { + Adds a news-aggregator PE to the given portal. + + @param portal_id The page to add self to + @param package_id The community with the folder + + @return element_id The new element's id +} { + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -value $package_id \ + -force_region [parameter::get_from_package_key \ + -parameter "news_aggregator_portlet_force_region" \ + -package_key [my_package_key]] \ + -pretty_name [get_pretty_name] \ + -param_action $param_action + ] +} + + + +ad_proc -public news_aggregator_portlet::remove_self_from_page { + {-portal_id:required} + {-package_id:required} +} { + Removes a news-aggregator PE from the given page or the package_id of the + news-aggregator package from the portlet if there are others remaining + + @param portal_id The page to remove self from + @param package_id +} { + portal::remove_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -value $package_id +} + + + +ad_proc -public news_aggregator_portlet::show { + cf +} { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "news-aggregator-portlet" +} Index: openacs-4/packages/news-aggregator-portlet/www/news-aggregator-admin-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/www/news-aggregator-admin-portlet.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/www/news-aggregator-admin-portlet.adp 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,3 @@ +

      Index: openacs-4/packages/news-aggregator-portlet/www/news-aggregator-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/www/news-aggregator-admin-portlet.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/www/news-aggregator-admin-portlet.tcl 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,23 @@ +ad_page_contract { + The display logic for the news aggregator portlet + + @author Simon Carstensen (simon@bcuni.net) +} -properties { + +} + + +array set config $cf +set user_id [ad_conn user_id] +set list_of_package_ids $config(package_id) + +if {[llength $list_of_package_ids] > 1} { + # We have a problem! + return -code error "There should be only one instance of news aggregator for admin purposes" +} + +set package_id [lindex $list_of_package_ids 0] +set url [lindex [site_node::get_url_from_object_id -object_id $package_id] 0] + + +ad_return_template Index: openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet-oracle.xql 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,28 @@ + + + +postgresql7.1 + + + + select s.source_id, + s.link, + s.description, + s.title, + to_char(last_scanned, 'YYYY-MM-DD HH24:MI:SS') as last_scanned, + to_char(creation_date, 'YYYY-MM-DD HH24') as sort_date, + feed_url, + item_id, + i.title as item_title, + i.link as item_link, + i.description as item_description + from na_sources s, na_items i + where s.source_id = i.source_id + and deleted_p = '0' + and package_id in ([join $list_of_package_ids ", "]) + and rownum <= 10 + order by creation_date desc + + + + Index: openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/www/Attic/news-aggregator-portlet-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet-postgresql.xql 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,31 @@ + + + +postgresql7.1 + + + + select s.source_id, + s.link, + s.description, + s.title, + to_char(last_scanned, 'YYYY-MM-DD HH24:MI:SS') as last_scanned, + to_char(creation_date, 'YYYY-MM-DD HH24') as sort_date, + (select site_node__url(site_nodes.node_id) + from site_nodes + where site_nodes.object_id = package_id) as url, + feed_url, + item_id, + i.title as item_title, + i.link as item_link, + i.description as item_description + from na_sources s left outer join + na_items i on (s.source_id = i.source_id) + where deleted_p = '0' + and package_id in ([join $list_of_package_ids ", "]) + order by creation_date desc + limit 10 + + + + Index: openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet.adp 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,51 @@ + + + + + + + + +
      + + + + + + + + + + + + + + + +
      @items.title@, @items.last_scanned@RSS
      + @items.content@ + + # + +  
      +
      + + + No Feeds. + + + +

      + » Add or remove subscriptions +

      +
      + +
      + + No Items + + +
      + +  + Index: openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet.tcl 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,26 @@ +ad_page_contract { + The display logic for the news aggregator portlet + @author Simon Carstensen (simon@bcuni.net) +} { + item_id:integer,notnull,optional,multiple +} -properties { + +} + +set user_id [ad_conn user_id] +set write_p [ad_permission_p $user_id write] + +array set config $cf +set shaded_p 0 + +set list_of_package_ids $config(package_id) +set one_instance_p [ad_decode [llength $list_of_package_ids] 1 1 0] + +db_multirow -extend content items select_items {} { + set text_only [string_truncate -len 300 $item_description] + if {[exists_and_not_null item_title] && ![string equal -nocase $item_title $text_only] } { + set content "$item_title. $text_only" + } else { + set content $text_only + } +} Index: openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news-aggregator-portlet/www/news-aggregator-portlet.xql 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,11 @@ + + + + + + + update na_items set deleted_p = '1' where item_id = :delete_id + + + + Index: openacs-4/packages/notifications/notifications.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/notifications.info,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/notifications/notifications.info 19 May 2003 17:22:26 -0000 1.19 +++ openacs-4/packages/notifications/notifications.info 28 Aug 2003 09:41:58 -0000 1.20 @@ -8,7 +8,7 @@ t notifications - + oracle postgresql @@ -17,10 +17,13 @@ Notification Management 2003-02-17 - + + + + Index: openacs-4/packages/notifications/sql/oracle/delivery-method-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/Attic/delivery-method-sc-create.sql,v diff -u -N --- openacs-4/packages/notifications/sql/oracle/delivery-method-sc-create.sql 9 Aug 2002 20:51:49 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,68 +0,0 @@ - --- --- The Notifications Package --- --- @author Ben Adida (ben@openforce.net) --- @version $Id: delivery-method-sc-create.sql,v 1.2 2002/08/09 20:51:49 yon Exp $ --- --- Copyright (C) 2000 MIT --- --- GNU GPL v2 --- - --- --- The service contract for defining a delivery method --- - -declare - foo integer; -begin - foo := acs_sc_contract.new ( - contract_name => 'NotificationDeliveryMethod', - contract_desc => 'Notification Delivery Method' - ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'NotificationDeliveryMethod.Send.InputType', - msg_type_spec => 'to_user_id:integer,reply_object_id:integer,notification_type_id:integer,subject:string,content:string' - ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'NotificationDeliveryMethod.Send.OutputType', - msg_type_spec => '' - ); - - foo := acs_sc_operation.new ( - contract_name => 'NotificationDeliveryMethod', - operation_name => 'Send', - operation_desc => 'send a notification', - operation_iscachable_p => 'f', - operation_nargs => 5, - operation_inputtype => 'NotificationDeliveryMethod.Send.InputType', - operation_outputtype => 'NotificationDeliveryMethod.Send.OutputType' - ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'NotificationDeliveryMethod.ScanReplies.InputType', - msg_type_spec => '' - ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'NotificationDeliveryMethod.ScanReplies.OutputType', - msg_type_spec => '' - ); - - foo := acs_sc_operation.new ( - contract_name => 'NotificationDeliveryMethod', - operation_name => 'ScanReplies', - operation_desc => 'scan for replies', - operation_iscachable_p => 'f', - operation_nargs => 0, - operation_inputtype => 'NotificationDeliveryMethod.ScanReplies.InputType', - operation_outputtype => 'NotificationDeliveryMethod.ScanReplies.OutputType' - ); - -end; -/ -show errors - Index: openacs-4/packages/notifications/sql/oracle/email-sc-impl-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/Attic/email-sc-impl-create.sql,v diff -u -N --- openacs-4/packages/notifications/sql/oracle/email-sc-impl-create.sql 9 Aug 2002 20:51:49 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,61 +0,0 @@ - --- --- The Notifications Package --- --- @author Ben Adida (ben@openforce.net) --- @version $Id: email-sc-impl-create.sql,v 1.3 2002/08/09 20:51:49 yon Exp $ --- --- Copyright (C) 2000 MIT --- --- GNU GPL v2 --- - --- --- The service contract implementation for email --- - -declare - impl_id integer; - foo integer; -begin - - impl_id := acs_sc_impl.new ( - 'NotificationDeliveryMethod', - 'notification_email', - 'notifications' - ); - - foo := acs_sc_impl.new_alias ( - 'NotificationDeliveryMethod', - 'notification_email', - 'Send', - 'notification::email::send', - 'TCL' - ); - - foo := acs_sc_impl.new_alias ( - 'NotificationDeliveryMethod', - 'notification_email', - 'ScanReplies', - 'notification::email::scan_replies', - 'TCL' - ); - - acs_sc_binding.new ( - contract_name => 'NotificationDeliveryMethod', - impl_name => 'notification_email' - ); - - foo:= notification_delivery_method.new( - short_name => 'email', - sc_impl_id => impl_id, - pretty_name => 'Email', - creation_user => null, - creation_ip => null - ); - - -end; -/ -show errors - Index: openacs-4/packages/notifications/sql/oracle/notification-type-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/Attic/notification-type-sc-create.sql,v diff -u -N --- openacs-4/packages/notifications/sql/oracle/notification-type-sc-create.sql 9 Aug 2002 20:51:49 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,68 +0,0 @@ - --- --- The Notifications Package --- --- @author Ben Adida (ben@openforce.net) --- @version $Id: notification-type-sc-create.sql,v 1.2 2002/08/09 20:51:49 yon Exp $ --- --- Copyright (C) 2000 MIT --- --- GNU GPL v2 --- - --- --- The service contract for a notification type --- - -declare - foo integer; -begin - foo := acs_sc_contract.new ( - contract_name => 'NotificationType', - contract_desc => 'Notification Type' - ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'NotificationType.GetURL.InputType', - msg_type_spec => 'object_id:integer' - ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'NotificationType.GetURL.OutputType', - msg_type_spec => 'url:string' - ); - - foo := acs_sc_operation.new ( - contract_name => 'NotificationType', - operation_name => 'GetURL', - operation_desc => 'gets the URL for an object in this notification type', - operation_iscachable_p => 'f', - operation_nargs => 1, - operation_inputtype => 'NotificationType.GetURL.InputType', - operation_outputtype => 'NotificationType.GetURL.OutputType' - ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'NotificationType.ProcessReply.InputType', - msg_type_spec => 'reply_id:integer' - ); - - foo := acs_sc_msg_type.new ( - msg_type_name => 'NotificationType.ProcessReply.OutputType', - msg_type_spec => 'success_p:boolean' - ); - - foo := acs_sc_operation.new ( - contract_name => 'NotificationType', - operation_name => 'ProcessReply', - operation_desc => 'Process a single reply', - operation_iscachable_p => 'f', - operation_nargs => 1, - operation_inputtype => 'NotificationType.ProcessReply.InputType', - operation_outputtype => 'NotificationType.ProcessReply.OutputType' - ); - -end; -/ -show errors - Index: openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql 17 May 2003 10:52:25 -0000 1.11 +++ openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql 28 Aug 2003 09:41:58 -0000 1.12 @@ -1,5 +1,5 @@ -- --- The Notifications Package +-- The Notifications -- -- @author Ben Adida (ben@openforce.net) -- @version $Id$ @@ -155,6 +155,9 @@ -- this is to allow responses to notifications response_id constraint notif_reponse_id_fk references acs_objects (object_id), + notif_user integer + constraint notif_user_id_fk + references users(user_id), notif_subject varchar(1000), notif_text clob, notif_html clob Index: openacs-4/packages/notifications/sql/oracle/notifications-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-create.sql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/notifications/sql/oracle/notifications-create.sql 9 Aug 2002 20:51:49 -0000 1.7 +++ openacs-4/packages/notifications/sql/oracle/notifications-create.sql 28 Aug 2003 09:41:58 -0000 1.8 @@ -16,11 +16,5 @@ @ notifications-replies-create.sql @ notifications-replies-package-create.sql --- the service contracts will eventually be created --- @ notifications-interval-sc-create.sql --- @ notifications-delivery-sc-create.sql - -@ notification-type-sc-create.sql -@ delivery-method-sc-create.sql @ notifications-init.sql -@ email-sc-impl-create.sql + Index: openacs-4/packages/notifications/sql/oracle/notifications-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-init.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/notifications/sql/oracle/notifications-init.sql 9 Aug 2002 20:51:49 -0000 1.4 +++ openacs-4/packages/notifications/sql/oracle/notifications-init.sql 28 Aug 2003 09:41:58 -0000 1.5 @@ -35,15 +35,6 @@ creation_ip => null ); --- This now done by email-sc-impl-create.sql --- --- v_foo:= notification_delivery_method.new( --- short_name => 'email', --- pretty_name => 'Email', --- creation_user => null, --- creation_ip => null --- ); - end; / show errors Index: openacs-4/packages/notifications/sql/oracle/notifications-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-package-create.sql,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/notifications/sql/oracle/notifications-package-create.sql 17 May 2003 10:52:25 -0000 1.8 +++ openacs-4/packages/notifications/sql/oracle/notifications-package-create.sql 28 Aug 2003 09:41:58 -0000 1.9 @@ -330,6 +330,7 @@ object_id in notifications.object_id%TYPE, notif_date in notifications.notif_date%TYPE default sysdate, response_id in notifications.response_id%TYPE default null, + notif_user in notifications.notif_user%TYPE default null, notif_subject in notifications.notif_subject%TYPE default null, notif_text in varchar default null, notif_html in varchar default null, @@ -358,6 +359,7 @@ object_id in notifications.object_id%TYPE, notif_date in notifications.notif_date%TYPE default sysdate, response_id in notifications.response_id%TYPE default null, + notif_user in notifications.notif_user%TYPE default null, notif_subject in notifications.notif_subject%TYPE default null, notif_text in varchar default null, notif_html in varchar default null, @@ -379,9 +381,9 @@ ); insert into notifications - (notification_id, type_id, object_id, notif_date, response_id, notif_subject, notif_text, notif_html) + (notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html) values - (v_notification_id, type_id, object_id, notif_date, response_id, notif_subject, notif_text, notif_html); + (v_notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html); return v_notification_id; end new; Index: openacs-4/packages/notifications/sql/oracle/upgrade/upgrade-4.6.2-4.6.4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/upgrade/upgrade-4.6.2-4.6.4.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/oracle/upgrade/upgrade-4.6.2-4.6.4.sql 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,99 @@ +-- +-- Upgrade script +-- +-- Adds a notif_user column to notifications table +-- +-- @author Lars Pind (lars@pinds.com) +-- @creation-date 2003-02-06 +-- + +-- add the column +alter table notifications add ( + notif_user integer + constraint notif_user_id_fk + references users(user_id) +); + + +-- Recreate the package + +create or replace package notification +as + + function new ( + notification_id in notifications.notification_id%TYPE default null, + type_id in notifications.type_id%TYPE, + object_id in notifications.object_id%TYPE, + notif_date in notifications.notif_date%TYPE default sysdate, + response_id in notifications.response_id%TYPE default null, + notif_user in notifications.notif_user%TYPE default null, + notif_subject in notifications.notif_subject%TYPE default null, + notif_text in varchar default null, + notif_html in varchar default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE, + context_id in acs_objects.context_id%TYPE default null + ) return notifications.notification_id%TYPE; + + procedure delete ( + notification_id in notifications.notification_id%TYPE default null + ); + +end notification; +/ +show errors + + + +create or replace package body notification +as + + function new ( + notification_id in notifications.notification_id%TYPE default null, + type_id in notifications.type_id%TYPE, + object_id in notifications.object_id%TYPE, + notif_date in notifications.notif_date%TYPE default sysdate, + response_id in notifications.response_id%TYPE default null, + notif_user in notifications.notif_user%TYPE default null, + notif_subject in notifications.notif_subject%TYPE default null, + notif_text in varchar default null, + notif_html in varchar default null, + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE, + creation_ip in acs_objects.creation_ip%TYPE, + context_id in acs_objects.context_id%TYPE default null + ) return notifications.notification_id%TYPE + is + v_notification_id acs_objects.object_id%TYPE; + begin + v_notification_id := acs_object.new ( + object_id => notification_id, + object_type => 'notification', + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); + + insert into notifications + (notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html) + values + (v_notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html); + + return v_notification_id; + end new; + + procedure delete ( + notification_id in notifications.notification_id%TYPE default null + ) + is + begin + delete from notifications where notification_id = notification.delete.notification_id; + + acs_object.delete (notification_id); + end delete; + +end notification; +/ +show errors 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 -N --- openacs-4/packages/notifications/sql/postgresql/delivery-method-sc-create.sql 9 Aug 2002 20:51:50 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,72 +0,0 @@ - --- --- The Notifications Package --- --- @author Ben Adida (ben@openforce.net) --- @version $Id: delivery-method-sc-create.sql,v 1.3 2002/08/09 20:51:50 yon Exp $ --- --- Copyright (C) 2000 MIT --- --- 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'' - ); - - PERFORM 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'; - -select inline_1(); -drop function inline_1(); Index: openacs-4/packages/notifications/sql/postgresql/email-sc-impl-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/Attic/email-sc-impl-create.sql,v diff -u -N --- openacs-4/packages/notifications/sql/postgresql/email-sc-impl-create.sql 9 Aug 2002 20:51:50 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,67 +0,0 @@ - --- --- The Notifications Package --- --- @author Ben Adida (ben@openforce.net) --- @version $Id: email-sc-impl-create.sql,v 1.2 2002/08/09 20:51:50 yon Exp $ --- --- Copyright (C) 2000 MIT --- --- GNU GPL v2 --- - --- --- The service contract implementation for email --- - -create function inline_1() returns integer as ' -declare - impl_id integer; - foo integer; -begin - - impl_id := acs_sc_impl__new ( - ''NotificationDeliveryMethod'', - ''notification_email'', - ''notifications'' - ); - - foo := acs_sc_impl_alias__new ( - ''NotificationDeliveryMethod'', - ''notification_email'', - ''Send'', - ''notification::email::send'', - ''TCL'' - ); - - foo := acs_sc_impl_alias__new ( - ''NotificationDeliveryMethod'', - ''notification_email'', - ''ScanReplies'', - ''notification::email::scan_replies'', - ''TCL'' - ); - - perform acs_sc_binding__new ( - ''NotificationDeliveryMethod'', - ''notification_email'' - ); - - foo:= notification_delivery_method__new( - NULL, - impl_id, - ''email'', - ''Email'', - now(), - null, - null, - null - ); - - return(0); - -end; -' language 'plpgsql'; - -select inline_1(); -drop function inline_1(); 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 -N --- openacs-4/packages/notifications/sql/postgresql/notification-type-sc-create.sql 9 Aug 2002 20:51:50 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,73 +0,0 @@ - --- --- The Notifications Package --- --- @author Ben Adida (ben@openforce.net) --- @version $Id: notification-type-sc-create.sql,v 1.2 2002/08/09 20:51:50 yon Exp $ --- --- Copyright (C) 2000 MIT --- --- 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-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 17 May 2003 10:53:27 -0000 1.10 +++ openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 28 Aug 2003 09:41:58 -0000 1.11 @@ -167,6 +167,10 @@ response_id integer constraint notif_reponse_id_fk references acs_objects (object_id), + -- this is the user that caused the notification to go out + notif_user integer + constraint notif_user_id_fk + references users(user_id), notif_subject varchar(1000), notif_text text, notif_html text @@ -199,78 +203,68 @@ -- -- Object Types -- -create function inline_0 () -returns integer as ' -begin +select acs_object_type__create_type( + 'notification_interval', + 'Notification Interval', + 'Notification Intervals', + 'acs_object', + 'notification_intervals', + 'interval_id', + 'notification_interval', + 'f', + null, + null +); - perform acs_object_type__create_type( - ''notification_interval'', - ''Notification Interval'', - ''Notification Intervals'', - ''acs_object'', - ''notification_intervals'', - ''interval_id'', - ''notification_interval'', - ''f'', - null, - null - ); +select acs_object_type__create_type( + 'notification_delivery_method', + 'Notification Delivery Method', + 'Notification Delivery Methods', + 'acs_object', + 'notification_delivery_methods', + 'delivery_method_id', + 'notification_delivery_method', + 'f', + null, + null +); - perform acs_object_type__create_type( - ''notification_delivery_method'', - ''Notification Delivery Method'', - ''Notification Delivery Methods'', - ''acs_object'', - ''notification_delivery_methods'', - ''delivery_method_id'', - ''notification_delivery_method'', - ''f'', - null, - null - ); +select acs_object_type__create_type( + 'notification_type', + 'Notification Type', + 'Notification Types', + 'acs_object', + 'notification_types', + 'type_id', + 'notification_type', + 'f', + null, + null +); - perform acs_object_type__create_type( - ''notification_type'', - ''Notification Type'', - ''Notification Types'', - ''acs_object'', - ''notification_types'', - ''type_id'', - ''notification_type'', - ''f'', - null, - null - ); +select acs_object_type__create_type( + 'notification_request', + 'Notification Request', + 'Notification Requests', + 'acs_object', + 'notification_requests', + 'request_id', + 'notification_request', + 'f', + null, + null +); - perform acs_object_type__create_type( - ''notification_request'', - ''Notification Request'', - ''Notification Requests'', - ''acs_object'', - ''notification_requests'', - ''request_id'', - ''notification_request'', - ''f'', - null, - null - ); +select acs_object_type__create_type( + 'notification', + 'Notification', + 'Notifications', + 'acs_object', + 'notifications', + 'notification_id', + 'notification', + 'f', + null, + null +); - perform acs_object_type__create_type( - ''notification'', - ''Notification'', - ''Notifications'', - ''acs_object'', - ''notifications'', - ''notification_id'', - ''notification'', - ''f'', - null, - null - ); - - return null; - -end;' language 'plpgsql'; - -select inline_0(); -drop function inline_0(); 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 -N -r1.5 -r1.6 --- openacs-4/packages/notifications/sql/postgresql/notifications-create.sql 9 Aug 2002 20:51:50 -0000 1.5 +++ openacs-4/packages/notifications/sql/postgresql/notifications-create.sql 28 Aug 2003 09:41:58 -0000 1.6 @@ -14,12 +14,4 @@ \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 - -\i delivery-method-sc-create.sql \i notifications-init.sql -\i email-sc-impl-create.sql Index: openacs-4/packages/notifications/sql/postgresql/notifications-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-init.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/notifications/sql/postgresql/notifications-init.sql 9 Aug 2002 20:51:50 -0000 1.4 +++ openacs-4/packages/notifications/sql/postgresql/notifications-init.sql 28 Aug 2003 09:41:58 -0000 1.5 @@ -8,56 +8,32 @@ -- GNU GPL v2 -- --- initialize some stuff -create function inline_0 () -returns integer as ' -begin +select notification_interval__new ( + null, + 'daily', + 3600 * 24, + now(), + null, + null, + null +); - perform notification_interval__new ( - null, - ''daily'', - 3600 * 24, - now(), - null, - null, - null - ); +select notification_interval__new ( + null, + 'hourly', + 3600, + now(), + null, + null, + null +); - perform notification_interval__new ( - null, - ''hourly'', - 3600, - now(), - null, - null, - null - ); - - perform notification_interval__new ( - null, - ''instant'', - 0, - now(), - null, - null, - null - ); - --- This is now done by email-sc-impl-create.sql --- --- perform notification_delivery_method__new ( --- null, --- ''email'', --- ''Email'', --- now(), --- null, --- null, --- null --- ); - - return null; - -end;' language 'plpgsql'; - -select inline_0(); -drop function inline_0 (); +select notification_interval__new ( + null, + 'instant', + 0, + now(), + null, + null, + null +); Index: openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql 17 May 2003 10:53:27 -0000 1.11 +++ openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql 28 Aug 2003 09:41:58 -0000 1.12 @@ -236,23 +236,24 @@ end; ' language 'plpgsql'; -select define_function_args ('notification__new','notification_id,type_id,object_id,notif_date,response_id,notif_subject,notif_text,notif_html,creation_date,creation_user,creation_ip,context_id'); +select define_function_args ('notification__new','notification_id,type_id,object_id,notif_date,response_id,notif_user,notif_subject,notif_text,notif_html,creation_date,creation_user,creation_ip,context_id'); -create function notification__new(integer,integer,integer,timestamptz,integer,varchar,text,text,timestamptz,integer,varchar,integer) +create or replace function notification__new(integer,integer,integer,timestamptz,integer,integer,varchar,text,text,timestamptz,integer,varchar,integer) returns integer as ' declare p_notification_id alias for $1; p_type_id alias for $2; p_object_id alias for $3; p_notif_date alias for $4; p_response_id alias for $5; - p_notif_subject alias for $6; - p_notif_text alias for $7; - p_notif_html 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; + p_notif_user alias for $6; + p_notif_subject alias for $7; + p_notif_text alias for $8; + p_notif_html alias for $9; + p_creation_date alias for $10; + p_creation_user alias for $11; + p_creation_ip alias for $12; + p_context_id alias for $13; v_notification_id integer; v_notif_date notifications.notif_date%TYPE; begin @@ -273,9 +274,9 @@ insert into notifications - (notification_id, type_id, object_id, notif_date, response_id, notif_subject, notif_text, notif_html) + (notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html) values - (v_notification_id, p_type_id, p_object_id, v_notif_date, p_response_id, p_notif_subject, p_notif_text, p_notif_html); + (v_notification_id, p_type_id, p_object_id, v_notif_date, p_response_id, p_notif_user, p_notif_subject, p_notif_text, p_notif_html); return v_notification_id; end; Index: openacs-4/packages/notifications/sql/postgresql/upgrade/upgrade-4.6.2-4.6.4.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/upgrade/upgrade-4.6.2-4.6.4.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/postgresql/upgrade/upgrade-4.6.2-4.6.4.sql 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,69 @@ +-- +-- Upgrade script +-- +-- Adds a notif_user column to notifications table +-- +-- @author Lars Pind (lars@pinds.com) +-- @creation-date 2003-02-06 +-- + + +-- add the column +alter table notifications add + notif_user integer + constraint notif_user_id_fk + references users(user_id); + + + +-- First, drop the old __new function +delete from acs_function_args where function = upper('notification__new'); +drop function notification__new(integer,integer,integer,timestamptz,integer,varchar,text,text,timestamptz,integer,varchar,integer); + + +-- The define the new one +select define_function_args ('notification__new','notification_id,type_id,object_id,notif_date,response_id,notif_user,notif_subject,notif_text,notif_html,creation_date,creation_user,creation_ip,context_id'); + +create or replace function notification__new(integer,integer,integer,timestamptz,integer,integer,varchar,text,text,timestamptz,integer,varchar,integer) +returns integer as ' +declare + p_notification_id alias for $1; + p_type_id alias for $2; + p_object_id alias for $3; + p_notif_date alias for $4; + p_response_id alias for $5; + p_notif_user alias for $6; + p_notif_subject alias for $7; + p_notif_text alias for $8; + p_notif_html alias for $9; + p_creation_date alias for $10; + p_creation_user alias for $11; + p_creation_ip alias for $12; + p_context_id alias for $13; + v_notification_id integer; + v_notif_date notifications.notif_date%TYPE; +begin + v_notification_id := acs_object__new( + p_notification_id, + ''notification'', + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + if p_notif_date is null then + v_notif_date := now(); + else + v_notif_date := p_notif_date; + end if; + + insert + into notifications + (notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html) + values + (v_notification_id, p_type_id, p_object_id, v_notif_date, p_response_id, p_notif_user, p_notif_subject, p_notif_text, p_notif_html); + + return v_notification_id; +end; +' language 'plpgsql'; Index: openacs-4/packages/notifications/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/apm-callback-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/tcl/apm-callback-procs.tcl 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,204 @@ + +ad_library { + APM callback procedures. + + @creation-date 2003-06-12 + @author Lars Pind (lars@collaboraid.biz) + @cvs-id $Id: apm-callback-procs.tcl,v 1.2 2003/08/28 09:41:58 lars Exp $ +} + +namespace eval notification::apm {} + +ad_proc -public notification::apm::after_install {} { + db_transaction { + + # Create the delivery method service contract + create_delivery_method_contract + + # Register email delivery method service contract implementation + set impl_id [create_email_delivery_method_impl] + + # Register the service contract implementation with the notifications service + register_email_delivery_method -impl_id $impl_id + + # Create the notification type service contract + create_notification_type_contract + } +} + +ad_proc -public notification::apm::before_uninstall {} { + db_transaction { + + # Delete the notification type service contract + delete_notification_type_contract + + # Delete the service contract implementation from the notifications service + unregister_email_delivery_method + + # Unregister email delivery method service contract implementation + delete_email_delivery_method_impl + + # Delete the delivery method service contract + delete_delivery_method_contract + + } +} + +ad_proc -public notification::apm::after_upgrade { + {-from_version_name:required} + {-to_version_name:required} +} { + apm_upgrade_logic \ + -from_version_name $from_version_name \ + -to_version_name $to_version_name \ + -spec { + 4.6.2 4.6.4 { + db_transaction { + + # Delete and recreate contract + delete_delivery_method_contract + create_delivery_method_contract + + # The old implementation is still there, but now it's unbound + + # Now change the name of the old implementation + db_dml update { update acs_sc_impls set impl_name = 'notification_email_old' where impl_name = 'notification_email' } + db_dml update { update acs_sc_impl_aliases set impl_name = 'notification_email_old' where impl_name = 'notification_email' } + + # Create the new implementation + set impl_id [create_email_delivery_method_impl] + + # Register the new impl ID with notification_delivery_methods + update_email_delivery_method_impl -impl_id $impl_id + + # Delete the old implementation + delete_email_delivery_method_impl -impl_name "notification_email_old" + + } + } + } +} + + +ad_proc -public notification::apm::create_delivery_method_contract {} { + acs_sc::contract::new_from_spec \ + -spec { + name "NotificationDeliveryMethod" + description "Notification Delivery Method" + operations { + Send { + description "Send a notification" + input { + from_user_id:integer + to_user_id:integer + reply_object_id:integer + notification_type_id:integer + subject:string + content:string + } + } + ScanReplies { + description "Scan for replies" + } + } + } +} + +ad_proc -public notification::apm::delete_delivery_method_contract {} { + acs_sc::contract::delete -name "NotificationDeliveryMethod" +} + +ad_proc -public notification::apm::create_email_delivery_method_impl {} { + Register the service contract implementation and return the impl_id + + @return impl_id of the created implementation +} { + return [acs_sc::impl::new_from_spec -spec { + contract_name "NotificationDeliveryMethod" + name "notification_email" + owner "notifications" + aliases { + Send notification::email::send + ScanReplies notification::email::scan_replies + } + }] +} + +ad_proc -public notification::apm::delete_email_delivery_method_impl { + {-impl_name "notification_email"} +} { + Unregister the NotificationDeliveryMethod service contract implementation for email. +} { + acs_sc::impl::delete \ + -contract_name "NotificationDeliveryMethod" \ + -impl_name $impl_name +} + +ad_proc -public notification::apm::register_email_delivery_method { + -impl_id:required +} { + Register the email delivery method with the notifications service. + + @param impl_id The ID of the NotificationDeliveryMethod service contract implementation. +} { + notification::delivery::new \ + -sc_impl_id $impl_id \ + -short_name "email" \ + -pretty_name "Email" +} + +ad_proc -public notification::apm::update_email_delivery_method_impl { + -impl_id:required +} { + Register the email delivery method with the notifications service. + + @param impl_id The ID of the NotificationDeliveryMethod service contract implementation. +} { + set delivery_method_id [notification::delivery::get_id -short_name "email"] + + notification::delivery::update_sc_impl_id \ + -delivery_method_id $delivery_method_id \ + -sc_impl_id $impl_id +} + +ad_proc -public notification::apm::unregister_email_delivery_method {} { + Unregister the service contract delivery method with the notifications service. +} { + set delivery_method_id [notification::delivery::get_id -short_name "email"] + + notification::delivery::delete \ + -delivery_method_id $delivery_method_id +} + +ad_proc -public notification::apm::create_notification_type_contract {} { + acs_sc::contract::new_from_spec \ + -spec { + name "NotificationType" + description "Notification Type" + operations { + GetURL { + description "Gets the URL for an object in this notification type" + input { + object_id:integer + } + output { + url:string + } + } + ProcessReply { + description "Process a single reply" + input { + reply_id:integer + } + output { + success_p:boolean + } + + } + } + } +} + +ad_proc -public notification::apm::delete_notification_type_contract {} { + acs_sc::contract::delete -name "NotificationType" +} Index: openacs-4/packages/notifications/tcl/delivery-method-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/delivery-method-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/tcl/delivery-method-procs-oracle.xql 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,14 @@ + + + + oracle8.1.6 + + + + begin + notification_delivery_method.delete(:delivery_method_id); + end; + + + + Index: openacs-4/packages/notifications/tcl/delivery-method-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/delivery-method-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/tcl/delivery-method-procs-postgresql.xql 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,12 @@ + + + + postgresql7.1 + + + + select notification_delivery_method__delete(:delivery_method_id) + + + + Index: openacs-4/packages/notifications/tcl/delivery-method-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/delivery-method-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 17 Jun 2003 01:04:46 -0000 1.7 +++ openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 28 Aug 2003 09:41:58 -0000 1.8 @@ -14,79 +14,108 @@ } -namespace eval notification::delivery { +namespace eval notification::delivery {} - ad_proc -private get_impl_key { - {-delivery_method_id:required} - } { - Return the service contract implementation key for notification delivery methods - } { - return [db_string select_impl_key {}] - } - ad_proc -public send { - {-delivery_method_id:required} - {-reply_object_id ""} - {-notification_type_id:required} - {-to_user_id:required} - {-subject:required} - {-content:required} - } { - do the delivery of certain content to a particular user using a particular delivery method. - This is just a wrapper proc that sets up the call to the service contract implementation for - a given delivery method. - } { - #need to check if its ok to notify this user in this way. For now just checks if they are an approved user. - if { ![notification::security::can_notify_user -user_id $to_user_id -delivery_method_id $delivery_method_id] } { - ns_log notice "Blocked notification to $to_user_id subject:$subject" - return "Blocked" - } +ad_proc -private notification::delivery::get_impl_key { + {-delivery_method_id:required} +} { + Return the service contract implementation key for notification delivery methods +} { + return [db_string select_impl_key {}] +} - # Get the implementation key - set impl_key [get_impl_key -delivery_method_id $delivery_method_id] - - # Prepare the arguments - set args [list $to_user_id $reply_object_id $notification_type_id $subject $content] - - # Make the generic call - return [acs_sc_call NotificationDeliveryMethod Send $args $impl_key] +ad_proc -public notification::delivery::send { + {-delivery_method_id:required} + {-reply_object_id ""} + {-notification_type_id:required} + {-from_user_id ""} + {-to_user_id:required} + {-subject:required} + {-content:required} +} { + do the delivery of certain content to a particular user using a particular delivery method. + This is just a wrapper proc that sets up the call to the service contract implementation for + a given delivery method. +} { + #need to check if its ok to notify this user in this way. For now just checks if they are an approved user. + if { ![notification::security::can_notify_user -user_id $to_user_id -delivery_method_id $delivery_method_id] } { + ns_log notice "Blocked notification to $to_user_id subject:$subject" + return "Blocked" } - ad_proc -public scan_replies { - {-delivery_method_id:required} - } { - scan for replies. - - Every delivery method allows for replies. This is the wrapper proc that - indicates to the delivery method service contract implementation that it's time to - scan for replies. - } { - # Get the implementation key - set impl_key [get_impl_key -delivery_method_id $delivery_method_id] + # Get the implementation key + set impl_key [get_impl_key -delivery_method_id $delivery_method_id] - # Prepare the arguments - set args [list] + # Prepare the arguments + set args [list $from_user_id $to_user_id $reply_object_id $notification_type_id $subject $content] - # ns_log Notice "NOTIF-DELIV-METHOD: about to call acs_sc on $impl_key" + # Make the generic call + return [acs_sc_call NotificationDeliveryMethod Send $args $impl_key] +} - # Make the generic call - return [acs_sc_call NotificationDeliveryMethod ScanReplies $args $impl_key] - } +ad_proc -public notification::delivery::scan_replies { + {-delivery_method_id:required} +} { + scan for replies. + + Every delivery method allows for replies. This is the wrapper proc that + indicates to the delivery method service contract implementation that it's time to + scan for replies. +} { + # Get the implementation key + set impl_key [get_impl_key -delivery_method_id $delivery_method_id] - ad_proc -public get_id_from_name { - -name:required - } { + # Prepare the arguments + set args [list] - Return the delivery_method_id for the given name + # ns_log Notice "NOTIF-DELIV-METHOD: about to call acs_sc on $impl_key" - @param name A delivery type name (email etc) + # Make the generic call + return [acs_sc_call NotificationDeliveryMethod ScanReplies $args $impl_key] +} - @author Don Baccus (dhogaza@pacifier.com) +ad_proc -public notification::delivery::new { + {-delivery_method_id ""} + {-sc_impl_id:required} + {-short_name:required} + {-pretty_name:required} +} { + Register a new delivery method with the notification service. +} { + set extra_vars [ns_set create] - } { + oacs_util::vars_to_ns_set \ + -ns_set $extra_vars \ + -var_list {delivery_method_id sc_impl_id short_name pretty_name} + + return [package_instantiate_object \ + -extra_vars $extra_vars \ + "notification_delivery_method"] +} - return [db_string get_delivery_method_id {}] +ad_proc -public notification::delivery::delete { + {-delivery_method_id:required} +} { + Unregister a delivery method with the notification service. +} { + db_exec_plsql delete {} +} - } +ad_proc -public notification::delivery::update_sc_impl_id { + {-delivery_method_id ""} + {-sc_impl_id:required} +} { + Register a new service contract implementation with an existing delivery method. +} { + db_dml update {} +} +ad_proc -public notification::delivery::get_id { + {-short_name:required} +} { + Return the delivery_method_id from the short_name. +} { + return [db_string select_delivery_method_id {}] } + Index: openacs-4/packages/notifications/tcl/delivery-method-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/delivery-method-procs.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/notifications/tcl/delivery-method-procs.xql 17 Jun 2003 01:04:46 -0000 1.3 +++ openacs-4/packages/notifications/tcl/delivery-method-procs.xql 28 Aug 2003 09:41:58 -0000 1.4 @@ -2,20 +2,28 @@ - - - select impl_name from acs_sc_impls, notification_delivery_methods - where acs_sc_impls.impl_id = notification_delivery_methods.sc_impl_id + + + select impl_name from acs_sc_impls, notification_delivery_methods + where acs_sc_impls.impl_id = notification_delivery_methods.sc_impl_id and delivery_method_id= :delivery_method_id - - + + + + + select delivery_method_id + from notification_delivery_methods + where short_name = :short_name + + - - - select delivery_method_id - from notification_delivery_methods where short_name = 'email' - - + + + update notification_delivery_methods + set sc_impl_id = :sc_impl_id + where delivery_method_id = :delivery_method_id + + Index: openacs-4/packages/notifications/tcl/notification-email-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-email-procs.tcl,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/notifications/tcl/notification-email-procs.tcl 17 May 2003 10:54:25 -0000 1.12 +++ openacs-4/packages/notifications/tcl/notification-email-procs.tcl 28 Aug 2003 09:41:58 -0000 1.13 @@ -81,13 +81,16 @@ } ad_proc -public send { + from_user_id to_user_id reply_object_id notification_type_id subject content } { - Send the actual email + Send the actual email. + + @param from_user_id The user_id of the user that the email should be sent as. Leave empty for the standard mailer from address. } { # Get email set email [cc_email_from_party $to_user_id] @@ -96,11 +99,31 @@ set manage_notifications_url [manage_notifications_url] append content "\n[_ notifications.lt_Getting_too_much_emai]" + # Use this to build up extra mail headers + set extra_headers [ns_set new] + + # This should disable most auto-replies. + ns_set put $extra_headers Precedence list + + set reply_to [reply_address -object_id $reply_object_id -type_id $notification_type_id] + + if { ![empty_string_p $from_user_id] && [db_0or1row get_person {}]} { + set from_email "\"$first_names $last_name\" <[cc_email_from_party $from_user_id]>" + + # Set the Reply-To and Mail-Followup-To addresses to the + # address of the notifications handler. + ns_set put $extra_headers Reply-To $reply_to + ns_set put $extra_headers Mail-Followup-To $reply_to + } else { + set from_email $reply_to + } + acs_mail_lite::send \ -to_addr $email \ - -from_addr [reply_address -object_id $reply_object_id -type_id $notification_type_id] \ + -from_addr $from_email \ -subject $subject \ - -body $content + -body $content \ + -extraheaders $extra_headers } ad_proc -private load_qmail_mail_queue { @@ -131,9 +154,9 @@ if [catch {set f [open $msg r]}] { continue } - set file [read $f] + set orig_file [read $f] close $f - set file [split $file "\n"] + set file [split $orig_file "\n"] set new_messages 1 set end_of_headers_p 0 @@ -142,35 +165,63 @@ set headers [list] # walk through the headers and extract each one + set is_auto_reply_p 0 while ![empty_string_p $line] { set next_line [lindex $file [expr $i + 1]] if {[regexp {^[ ]*$} $next_line match] && $i > 0} { set end_of_headers_p 1 } + set multiline_header_p 0 if {[regexp {^([^:]+):[ ]+(.+)$} $line match name value]} { # join headers that span more than one line (e.g. Received) if { ![regexp {^([^:]+):[ ]+(.+)$} $next_line match] && !$end_of_headers_p} { - append line $next_line - incr i + set multiline_header_p 1 + } else { + # we only want messages a person typed in themselves - nothing + # from any sort of auto-responder. + if { [string compare -nocase $name "Auto-Submitted"] == 0 } { + set is_auto_reply_p 1 + break + } elseif { [string compare -nocase $name "Subject"] == 0 && [string first "Out of Office AutoReply:" $value] == 0 } { + # added for BP + set is_auto_reply_p 1 + break + } else { + lappend headers [string tolower $name] $value } - lappend headers [string tolower $name] $value + } if {$end_of_headers_p} { - incr i - break + incr i + break } } else { # The headers and the body are delimited by a null line as specified by RFC822 if {[regexp {^[ ]*$} $line match]} { - incr i - break + incr i + break } } incr i - set line [lindex $file $i] + if { $multiline_header_p } { + append line [lindex $file $i] + } else { + set line [lindex $file $i] + } } - set body "\n[join [lrange $file $i end] "\n"]" + # a break above just exited the while loop; now we need to skip + # the rest of the foreach as well + if { $is_auto_reply_p } { + ns_log Notice "NOTIF-INCOMING-EMAIL: message is from an auto-responder, skipping" + if {[catch {ns_unlink $msg} errmsg]} { + ns_log Notice "NOTIF-INCOMING-EMAIL: couldn't remove message $msg: $errmsg" + } + continue + } + + set body [parse_incoming_email $orig_file] + # okay now we have a list of headers and the body, let's # put it into notifications stuff array set email_headers $headers @@ -192,7 +243,7 @@ if {[empty_string_p $from_user]} { ns_log Notice "NOTIF-INCOMING-EMAIL: no user $from" if {[catch {ns_unlink $msg} errmsg]} { - ns_log Notice "NOTIF-INCOMING-EMAIL: couldn't remove message" + ns_log Notice "NOTIF-INCOMING-EMAIL: couldn't remove message $msg: $errmsg" } continue } @@ -203,7 +254,7 @@ if {[empty_string_p $to_stuff]} { ns_log Notice "NOTIF-INCOMING-EMAIL: bad to address $to" if {[catch {ns_unlink $msg} errmsg]} { - ns_log Notice "NOTIF-INCOMING-EMAIL: couldn't remove message" + ns_log Notice "NOTIF-INCOMING-EMAIL: couldn't remove message $msg: $errmsg" } continue } Index: openacs-4/packages/notifications/tcl/notification-email-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-email-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/tcl/notification-email-procs.xql 28 Aug 2003 09:41:58 -0000 1.2 @@ -0,0 +1,13 @@ + + + + + + select first_names, last_name + from persons + where person_id = :from_user_id + + + + + Index: openacs-4/packages/notifications/tcl/notification-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/notifications/tcl/notification-procs.tcl 17 May 2003 10:54:25 -0000 1.7 +++ openacs-4/packages/notifications/tcl/notification-procs.tcl 28 Aug 2003 09:41:58 -0000 1.8 @@ -83,6 +83,7 @@ {-force:boolean} {-default_request_data {}} {-return_notified:boolean} + {-notif_user {}} } { Create a new notification if any notification requests exist for the object and type. @@ -264,6 +265,10 @@ } } + if { [empty_string_p $notif_user] && [ad_conn isconnected] } { + set notif_user [ad_conn user_id] + } + # Actually carry out inserting the notification db_transaction { if { $subset_arg_p || $already_notified_arg_p } { @@ -290,9 +295,14 @@ set object_id $action_id } + # Truncate notif_subject to the max len of 100 + set notif_subject [string_truncate -len 100 $notif_subject] + # Set up the vars set extra_vars [ns_set create] - oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {notification_id type_id object_id response_id notif_subject notif_text notif_html} + oacs_util::vars_to_ns_set \ + -ns_set $extra_vars \ + -var_list {notification_id type_id object_id response_id notif_subject notif_text notif_html notif_user} # Create the notification package_instantiate_object -extra_vars $extra_vars notification Index: openacs-4/packages/notifications/tcl/notification-reply-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-reply-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/notifications/tcl/notification-reply-procs.tcl 30 Nov 2002 17:40:18 -0000 1.4 +++ openacs-4/packages/notifications/tcl/notification-reply-procs.tcl 28 Aug 2003 09:41:58 -0000 1.5 @@ -25,6 +25,10 @@ store a new reply } { set extra_vars [ns_set create] + + # Truncate subject to 100 chars, which is the limit in the data model (for some obscure reason) + set subject [string range $subject 0 99] + oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {reply_id object_id type_id from_user subject content reply_date} set reply_id [package_instantiate_object -extra_vars $extra_vars notification_reply] Index: openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql 4 Jul 2003 21:18:32 -0000 1.13 +++ openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql 28 Aug 2003 09:41:58 -0000 1.14 @@ -34,7 +34,8 @@ notification_requests.delivery_method_id, notification_requests.request_id, notifications.response_id, - notifications.notif_date + notifications.notif_date, + notifications.notif_user from notifications, notification_requests where notifications.type_id = notification_requests.type_id and notifications.object_id = notification_requests.object_id Index: openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql 4 Jul 2003 21:18:32 -0000 1.6 +++ openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql 28 Aug 2003 09:41:58 -0000 1.7 @@ -26,7 +26,8 @@ type_id, delivery_method_id, response_id, - notif_date + notif_date, + notif_user from notifications inner join notification_requests using (type_id, object_id) inner join acs_objects on (notification_requests.request_id = acs_objects.object_id) left outer join notification_user_map using (notification_id, user_id) Index: openacs-4/packages/notifications/tcl/sweep-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/sweep-procs.tcl,v diff -u -N -r1.14 -r1.15 --- openacs-4/packages/notifications/tcl/sweep-procs.tcl 17 May 2003 10:54:26 -0000 1.14 +++ openacs-4/packages/notifications/tcl/sweep-procs.tcl 28 Aug 2003 09:41:58 -0000 1.15 @@ -128,12 +128,13 @@ db_transaction { # Send it notification::delivery::send \ - -to_user_id [ns_set get $notif user_id] \ - -notification_type_id [ns_set get $notif type_id] \ - -subject [ns_set get $notif notif_subject] \ - -content [ns_set get $notif notif_text] \ - -reply_object_id [ns_set get $notif response_id] \ - -delivery_method_id [ns_set get $notif delivery_method_id] + -from_user_id [ns_set get $notif notif_user] \ + -to_user_id [ns_set get $notif user_id] \ + -notification_type_id [ns_set get $notif type_id] \ + -subject [ns_set get $notif notif_subject] \ + -content [ns_set get $notif notif_text] \ + -reply_object_id [ns_set get $notif response_id] \ + -delivery_method_id [ns_set get $notif delivery_method_id] # Markt it as sent notification::mark_sent \ Index: openacs-4/packages/robot-detection/robot-detection.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/robot-detection/robot-detection.info,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/robot-detection/robot-detection.info 17 May 2003 11:14:29 -0000 1.4 +++ openacs-4/packages/robot-detection/robot-detection.info 28 Aug 2003 09:41:58 -0000 1.5 @@ -49,7 +49,7 @@ - + Index: openacs-4/packages/robot-detection/tcl/robot-detection-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/robot-detection/tcl/robot-detection-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/robot-detection/tcl/robot-detection-procs.tcl 9 Mar 2002 02:00:02 -0000 1.2 +++ openacs-4/packages/robot-detection/tcl/robot-detection-procs.tcl 28 Aug 2003 09:41:58 -0000 1.3 @@ -4,7 +4,7 @@ @author Michael Yoon (michael@yoon.org) @author Roger Hsueh (rogerh@arsdigita.com) @creation-date 1999-05-27 - @cvs-id $Id$ + @cvs-id robot-detection-procs.tcl,v 1.2 2002/03/09 02:00:02 donb Exp } ad_proc ad_replicate_web_robots_db {} { Replicates data from the Web Robots Database @@ -39,12 +39,17 @@ db_dml delete_old_robots_table { delete from robots } - set robot_id [db_null] - set robot_name [db_null] - set robot_details_url [db_null] - set robot_useragent [db_null] + set robot_id "" + set robot_name "" + set robot_details_url "" + set robot_useragent "" foreach line $page { if {![regexp {\w+} $line]} { + + if { [string equal $robot_name ""] } { + set robot_name $robot_id + } + #detected a blank line, that means we are should try to #insert a row into the robots table, if robot_id and robot_useragent are not null if {[exists_and_not_null robot_id] && [exists_and_not_null robot_useragent]} { @@ -55,16 +60,17 @@ } } # start clean for a new record - set robot_id [db_null] - set robot_name [db_null] - set robot_details_url [db_null] - set robot_useragent [db_null] + set robot_id "" + set robot_name "" + set robot_details_url "" + set robot_useragent "" continue } - if {[regexp {robot-id: *(.+)} $line match robot_id] || - [regexp {robot-name: *(.+)} $line match robot_name] || - [regexp {robot-details-url: *(.+)} $line match robot_details_url] || - [regexp {robot-useragent: *(.+)} $line match robot_useragent] } { + + if {[regexp {robot-id:\s*([^\s]+)\s*} $line match robot_id] || + [regexp {robot-name:\s*([^\s]+)\s*} $line match robot_name] || + [regexp {robot-details-url:\s*([^\s]+)\s*} $line match robot_details_url] || + [regexp {robot-useragent:\s*([\s]+)\s*} $line match robot_useragent] } { continue } } Index: openacs-4/packages/robot-detection/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/robot-detection/www/admin/index.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/robot-detection/www/admin/index.adp 6 Sep 2002 15:36:39 -0000 1.2 +++ openacs-4/packages/robot-detection/www/admin/index.adp 28 Aug 2003 09:41:58 -0000 1.3 @@ -20,7 +20,7 @@

      -Courtesy of the Web Robots Database, +Courtesy of the Web Robots Database, this installation of the ACS can recognize the following robots:

        Index: openacs-4/packages/rss-support/tcl/rss-generation-service-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/tcl/rss-generation-service-procs-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/rss-support/tcl/rss-generation-service-procs-oracle.xql 17 May 2003 11:22:12 -0000 1.2 +++ openacs-4/packages/rss-support/tcl/rss-generation-service-procs-oracle.xql 28 Aug 2003 09:41:58 -0000 1.3 @@ -9,12 +9,12 @@ r.timeout, r.summary_context_id, i.impl_name, - nvl2(r.lastbuild, date_part('epoch',r.lastbuild), 0) as lastbuild + nvl2(r.lastbuild, (r.lastbuild-to_date('1970-01-01'))*60*60*24, 0) as lastbuild from rss_gen_subscrs r, acs_sc_impls i where i.impl_id = r.impl_id and (r.lastbuild is null - or sysdate > r.lastbuild + r.timeout/(60*60*24) + or sysdate > r.lastbuild + r.timeout/(60*60*24)) Index: openacs-4/packages/workflow/workflow.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/workflow.info,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/workflow/workflow.info 5 Mar 2003 17:17:05 -0000 1.5 +++ openacs-4/packages/workflow/workflow.info 28 Aug 2003 09:41:59 -0000 1.6 @@ -8,7 +8,7 @@ t workflow - + oracle postgresql @@ -22,10 +22,10 @@ <p> For more information, see: <a href="http://www.collaboraid.biz/developer/workflow-spec">the workflow specification</a>. - + - + Index: openacs-4/packages/workflow/sql/oracle/workflow-procedural-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/sql/oracle/workflow-procedural-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/workflow/sql/oracle/workflow-procedural-create.sql 5 Mar 2003 17:17:18 -0000 1.2 +++ openacs-4/packages/workflow/sql/oracle/workflow-procedural-create.sql 28 Aug 2003 09:41:59 -0000 1.3 @@ -10,7 +10,7 @@ --------------------------------- -- Workflow level, Generic Model --------------------------------- -create or replace package workflow_case +create or replace package workflow_case_pkg as function get_pretty_state( workflow_short_name in varchar, @@ -21,11 +21,11 @@ delete_case_id in integer ) return integer; -end workflow_case; +end workflow_case_pkg; / show errors -create or replace package body workflow_case +create or replace package body workflow_case_pkg as function get_pretty_state( workflow_short_name in varchar, @@ -74,7 +74,7 @@ return 0; end delete; -end workflow_case; +end workflow_case_pkg; / show errors @@ -114,7 +114,7 @@ from workflow_cases where workflow_id = delete_workflow_id) loop - foo := workflow_case.delete(rec.case_id); + foo := workflow_case_pkg.delete(rec.case_id); end loop; acs_object.delete(delete_workflow_id); Index: openacs-4/packages/workflow/sql/oracle/workflow-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/sql/oracle/workflow-tables-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/workflow/sql/oracle/workflow-tables-create.sql 5 Mar 2003 17:17:18 -0000 1.2 +++ openacs-4/packages/workflow/sql/oracle/workflow-tables-create.sql 28 Aug 2003 09:41:59 -0000 1.3 @@ -341,7 +341,7 @@ create table workflow_cases ( case_id integer - constraint wf_cases_pk + constraint workflow_cases_pk primary key, workflow_id constraint wf_cases_workflow_id_nn not null Index: openacs-4/packages/workflow/sql/postgresql/workflow-procedural-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/sql/postgresql/workflow-procedural-create.sql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/workflow/sql/postgresql/workflow-procedural-create.sql 5 Mar 2003 17:17:33 -0000 1.6 +++ openacs-4/packages/workflow/sql/postgresql/workflow-procedural-create.sql 28 Aug 2003 09:41:59 -0000 1.7 @@ -22,15 +22,15 @@ from workflow_cases where workflow_id = delete_workflow_id loop - perform workflow_case__delete (rec.case_id); + perform workflow_case_pkg__delete (rec.case_id); end loop; perform acs_object__delete(delete_workflow_id); return 0; end;' language 'plpgsql'; -create or replace function workflow_case__delete (integer) +create or replace function workflow_case_pkg__delete (integer) returns integer as ' declare delete_case_id alias for $1; @@ -48,7 +48,7 @@ -- All workflow data cascades from the case id delete from workflow_cases - where object_id = delete_case_id; + where case_id = delete_case_id; return 0; end;' language 'plpgsql'; @@ -101,7 +101,7 @@ -- Function for getting the pretty state of a case -create or replace function workflow_case__get_pretty_state ( +create or replace function workflow_case_pkg__get_pretty_state ( varchar, -- workflow_short_name integer -- object_id ) Index: openacs-4/packages/workflow/sql/postgresql/workflow-procedural-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/sql/postgresql/workflow-procedural-drop.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/workflow/sql/postgresql/workflow-procedural-drop.sql 12 Feb 2003 14:22:35 -0000 1.4 +++ openacs-4/packages/workflow/sql/postgresql/workflow-procedural-drop.sql 28 Aug 2003 09:41:59 -0000 1.5 @@ -36,5 +36,13 @@ varchar -- creation_ip ); +drop function workflow_case_pkg__delete (integer); + +drop function workflow_case_pkg__get_pretty_state ( + varchar, -- workflow_short_name + integer -- object_id +); + + delete from acs_function_args where function = 'workflow_case_log_entry__new'; Index: openacs-4/packages/workflow/tcl/case-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/case-procs-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/workflow/tcl/case-procs-oracle.xql 5 Mar 2003 17:18:10 -0000 1.2 +++ openacs-4/packages/workflow/tcl/case-procs-oracle.xql 28 Aug 2003 09:41:59 -0000 1.3 @@ -93,5 +93,12 @@ + + + begin + :1 := workflow_case.delete(:case_id); + end; + + Index: openacs-4/packages/workflow/tcl/case-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/case-procs-postgresql.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/workflow/tcl/case-procs-postgresql.xql 5 Mar 2003 17:18:10 -0000 1.3 +++ openacs-4/packages/workflow/tcl/case-procs-postgresql.xql 28 Aug 2003 09:41:59 -0000 1.4 @@ -85,4 +85,10 @@ + + + select workflow_case_pkg__delete(:case_id) + + + Index: openacs-4/packages/workflow/tcl/case-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/case-procs.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/workflow/tcl/case-procs.tcl 5 Mar 2003 17:18:10 -0000 1.6 +++ openacs-4/packages/workflow/tcl/case-procs.tcl 28 Aug 2003 09:41:59 -0000 1.7 @@ -24,13 +24,13 @@ {-object_id:required} } { Internal procedure that creates a new workflow case in the - database. Should not be used by applications. + database. Should not be used by applications. Use workflow::case::new instead. @param object_id The object_id which the case is about @param workflow_short_name The short_name of the workflow. @return The case_id of the case. Returns the empty string if no case could be found. - @see + @see workflow::case::new @author Lars Pind (lars@collaboraid.biz) } { @@ -147,6 +147,18 @@ return $row($element) } +ad_proc -public workflow::case::delete { + {-case_id:required} +} { + Delete a workflow case. + + @param case_id The case_id you wish to delete + + @author Simon Carstensen (simon@collaboraid.biz) +} { + db_exec_plsql delete_case {} +} + ad_proc -public workflow::case::get_user_roles { {-case_id:required} -user_id @@ -262,11 +274,339 @@ workflow::case::role::flush_cache $case_id } +ad_proc -private workflow::case::get_activity_html { + {-case_id:required} + {-action_id ""} +} { + Get the activity log for a case as an HTML chunk. + If action_id is non-empty, it means that we're in + the progress of executing that action, and the + corresponding line for the current action will be appended. + @param case_id The case for which you want the activity log. + @param action_id optional action which is currently being executed. + @return Activity log as HTML + @author Lars Pind (lars@collaboraid.biz) +} { + set log_html {} + set template { + @creation_date_pretty@ @action_pretty_past_tense@ @log_title@ by @community_member_link@ +
        @comment_html@
        + } + # Compile and evaluate the template + set code [template::adp_compile -string $template] + foreach entry_arraylist [get_activity_log_info -case_id $case_id] { + foreach { var value } $entry_arraylist { + set $var $value + } + + set comment_html [ad_html_text_convert -from $comment_mime_type -to "text/html" -- $comment] + set community_member_link [acs_community_member_link -user_id $creation_user -label "$user_first_names $user_last_name"] + + append log_html [template::adp_eval code] + } + + if { ![empty_string_p $action_id] } { + set pretty_past_tense [workflow::action::get_element -action_id $action_id -element pretty_past_tense] + + # sets first_names, last_name, email + ad_get_user_info + + set now_pretty [clock format [clock seconds] -format "%m/%d/%Y"] + # Get rid of leading zeros + regsub {^0} $now_pretty {} now_pretty + regsub {/0} $now_pretty {/} now_pretty + + append log_html "

        $now_pretty $pretty_past_tense by $first_names $last_name

        " + } + + return $log_html +} + +ad_proc -private workflow::case::get_activity_text { + {-case_id:required} +} { + Get the activity log for a case as a text chunk + + @author Lars Pind +} { + set log_text {} + + foreach entry_arraylist [get_activity_log_info -case_id $case_id] { + foreach { var value } $entry_arraylist { + set $var $value + } + + set entry_text "$creation_date_pretty $action_pretty_past_tense [ad_decode $log_title "" "" "$log_title "]y $user_first_names $user_last_name ($user_email)" + + if { ![empty_string_p $comment] } { + append entry_text ":\n\n [join [split [ad_html_text_convert -from $comment_mime_type -to "text/plain" -maxlen 66 -- $comment] "\n"] "\n "]" + } + + lappend log_text $entry_text + + + } + return [join $log_text "\n\n"] +} + +ad_proc -private workflow::case::get_activity_log_info { + {-case_id:required} +} { + Get the data for the case activity log. + + @return a list of array-lists with the following entries: + comment comment_mime_type creation_date_pretty action_pretty_past_tense log_title + user_first_names user_last_name user_email creation_user data_arraylist + + @author Lars Pind +} { + global __cache__workflow__case__get_activity_log_info + if { ![info exists __cache__workflow__case__get_activity_log_info] } { + set __cache__workflow__case__get_activity_log_info [get_activity_log_info_not_cached -case_id $case_id] + } + return $__cache__workflow__case__get_activity_log_info +} + +ad_proc -private workflow::case::get_activity_log_info_not_cached { + {-case_id:required} +} { + Get the data for the case activity log. This version is cached for a single thread. + + @return a list of array-lists with the following entries: + comment comment_mime_type creation_date_pretty action_pretty_past_tense log_title + user_first_names user_last_name user_email creation_user data_arraylist + + @author Lars Pind +} { + set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] + set object_id [workflow::case::get_element -case_id $case_id -element object_id] + set contract_name [workflow::service_contract::activity_log_format_title] + + # Get the name of any title Tcl callback proc + set impl_names [workflow::get_callbacks \ + -workflow_id $workflow_id \ + -contract_name $contract_name] + + # First, we build up a multirow so we have all the data in memory, which lets us peek ahead at the contents + db_multirow -extend {comment} -local entries select_log {} { set comment $comment_string } + + + set rowcount [template::multirow -local size entries] + set counter 1 + + set last_entry_id {} + set data_arraylist [list] + + # Then iterate over the multirow to build up the activity log HTML + # We need to peek ahead, because this is an outer join to get the rows in workflow_case_log_data + + set entries [list] + template::multirow -local foreach entries { + + if { ![empty_string_p $key] } { + lappend data_arraylist $key $value + } + + if { $counter == $rowcount || ![string equal $last_entry_id [set "entries:[expr $counter + 1](entry_id)"]] } { + + set log_title_elements [list] + foreach impl_name $impl_names { + set result [acs_sc::invoke \ + -contract $contract_name \ + -operation "GetTitle" \ + -impl $impl_name \ + -call_args [list $case_id $object_id $action_id $entry_id $data_arraylist]] + if { ![empty_string_p $result] } { + lappend log_title_elements $result + } + } + set log_title [ad_decode [llength $log_title_elements] 0 "" "([join $log_title_elements ", "])"] + + set row [list] + foreach var { + comment comment_mime_type creation_date_pretty action_pretty_past_tense log_title + user_first_names user_last_name user_email creation_user data_arraylist + } { + lappend row $var [set $var] + } + lappend entries $row + + set data_arraylist [list] + } + set last_entry_id $entry_id + incr counter + } + + return $entries +} + +ad_proc workflow::case::get_notification_object { + {-type:required} + {-workflow_id ""} + {-case_id ""} +} { + Get the relevant object for this notification type. + + @param type Type is one of 'workflow_assignee', 'workflow_my_cases', + 'workflow_case' (requires case_id), and 'workflow' (requires + workflow_id). +} { + switch $type { + workflow_case { + if { ![exists_and_not_null case_id] } { + return {} + } + return [workflow::case::get_element -case_id $case_id -element object_id] + } + default { + if { ![exists_and_not_null workflow_id] } { + return {} + } + return [workflow::get_element -workflow_id $workflow_id -element object_id] + } + } +} + +ad_proc workflow::case::get_notification_request_url { + {-type:required} + {-workflow_id ""} + {-case_id ""} + {-return_url ""} + {-pretty_name ""} +} { + Get the URL to subscribe to notifications + + @param type Type is one of 'workflow_assignee', 'workflow_my_cases', + 'workflow_case' (requires case_id), and 'workflow' (requires + workflow_id). +} { + if { [ad_conn user_id] == 0 } { + return {} + } + + set object_id [get_notification_object \ + -type $type \ + -workflow_id $workflow_id \ + -case_id $case_id] + + if { [empty_string_p $object_id] } { + return {} + } + + if { ![exists_and_not_null return_url] } { + set return_url [ad_return_url] + } + + set url [notification::display::subscribe_url \ + -type $type \ + -object_id $object_id \ + -url $return_url \ + -user_id [ad_conn user_id] \ + -pretty_name $pretty_name] + + return $url +} + +ad_proc workflow::case::get_notification_requests_multirow { + {-multirow_name:required} + {-label ""} + {-workflow_id ""} + {-case_id ""} + {-return_url ""} +} { + Returns a multirow with columns url, label, title, + of the possible workflow notification types. Use this to present the user with a list of + subscription links. +} { + array set pretty { + workflow_assignee {my actions} + workflow_my_cases {my cases} + workflow_case {this case} + workflow {cases in this workflow} + } + + template::multirow create $multirow_name url label title + foreach type { + workflow_assignee workflow_my_cases workflow_case workflow + } { + set url [get_notification_request_url \ + -type $type \ + -workflow_id $workflow_id \ + -case_id $case_id \ + -return_url $return_url] + + if { ![empty_string_p $url] } { + set title "Subscribe to $pretty($type)" + if { ![empty_string_p $label] } { + set row_label $label + } else { + set row_label $title + } + template::multirow append $multirow_name $url $row_label $title + } + } +} + +ad_proc workflow::case::add_log_data { + {-entry_id:required} + {-key:required} + {-value:required} +} { + Adds extra data information to a log entry, which can later + be retrieved using workflow::case::get_log_data_by_key. + Data are stored as simple key/value pairs. + + @param entry_id The ID of the log entry to which you want to attach data. + @param key The data key. + @param value The data value + + @see workflow::case::get_log_data_by_key + @see workflow::case::get_log_data + @author Lars Pind (lars@collaboraid.biz) +} { + db_dml insert_log_data {} +} + +ad_proc workflow::case::get_log_data_by_key { + {-entry_id:required} + {-key:required} +} { + Retrieve extra data for a workflow log entry, previously stored using workflow::case::add_log_data. + + @param entry_id The ID of the log entry to which the data you want are attached. + @param key The key of the data you're looking for. + @return The value, or the empty string if no such key exists for this entry. + + @see workflow::case::add_log_data + @see workflow::case::get_log_data + @author Lars Pind (lars@collaboraid.biz) +} { + db_string select_log_data {} -default {} +} + +ad_proc workflow::case::get_log_data { + {-entry_id:required} +} { + Retrieve extra data for a workflow log entry, previously stored using workflow::case::add_log_data. + + @param entry_id The ID of the log entry to which the data you want are attached. + @return A tcl list of key/value pairs in array-list format, i.e. { key1 value1 key2 value2 ... }. + + @see workflow::case::add_log_data + @see workflow::case::get_log_data_by_key + @author Lars Pind (lars@collaboraid.biz) +} { + db_string select_log_data {} -default {} +} + + + + ##### # # workflow::case::role namespace @@ -394,19 +734,12 @@ -impl $impl_name \ -call_args [list $case_id $object_id $role_id]] - ns_log Notice "LARS: $contract_name, $impl_name = $subquery" - if { ![empty_string_p $subquery] } { # Return after the first non-empty list break } } - ns_log Notice "LARS: subquery = $subquery" - - ns_log Notice "LARS: returning [db_map select_search_results]" - - return [db_map select_search_results] @@ -432,8 +765,8 @@ set query [workflow::case::role::get_search_query -case_id $case_id -role_id $role_id] set picklist [workflow::case::role::get_picklist -case_id $case_id -role_id $role_id] - return [list "${element}:search(search)" [list label $role(pretty_name)] [list mode display] \ - [list search_query $query] [list options $picklist] optional] + return [list "${element}:search(search),optional" [list label $role(pretty_name)] [list mode display] \ + [list search_query $query] [list options $picklist]] } ad_proc -public workflow::case::role::add_assignee_widgets { @@ -610,262 +943,9 @@ } } -ad_proc -private workflow::case::get_activity_html { - {-case_id:required} -} { - Get the activity log for a case as an HTML chunk - @author Lars Pind -} { - set log_html {} - set template { - @creation_date_pretty@ @action_pretty_past_tense@ @log_title@ by @community_member_link@ -
        @comment_html@
        - } - # Compile and evaluate the template - set code [template::adp_compile -string $template] - - foreach entry_arraylist [get_activity_log_info -case_id $case_id] { - foreach { var value } $entry_arraylist { - set $var $value - } - - set comment_html [ad_html_text_convert -from $comment_mime_type -to "text/html" -- $comment] - set community_member_link [acs_community_member_link -user_id $creation_user -label "$user_first_names $user_last_name"] - - append log_html [template::adp_eval code] - } - - return $log_html -} - -ad_proc -private workflow::case::get_activity_text { - {-case_id:required} -} { - Get the activity log for a case as a text chunk - - @author Lars Pind -} { - set log_text {} - - foreach entry_arraylist [get_activity_log_info -case_id $case_id] { - foreach { var value } $entry_arraylist { - set $var $value - } - - set entry_text "$creation_date_pretty $action_pretty_past_tense $log_title by $user_first_names $user_last_name ($user_email)" - - if { ![empty_string_p $comment] } { - append entry_text ":\n\n [join [split [ad_html_text_convert -from $comment_mime_type -to "text/plain" -maxlen 66 -- $comment] "\n"] "\n "]" - } - - lappend log_text $entry_text - - - } - return [join $log_text "\n\n"] -} - -ad_proc -private workflow::case::get_activity_log_info { - {-case_id:required} -} { - Get the data for the case activity log. - - @return a list of array-lists with the following entries: - comment comment_mime_type creation_date_pretty action_pretty_past_tense log_title - user_first_names user_last_name user_email creation_user data_arraylist - - @author Lars Pind -} { - global __cache__workflow__case__get_activity_log_info - if { ![info exists __cache__workflow__case__get_activity_log_info] } { - set __cache__workflow__case__get_activity_log_info [get_activity_log_info_not_cached -case_id $case_id] - } - return $__cache__workflow__case__get_activity_log_info -} - -ad_proc -private workflow::case::get_activity_log_info_not_cached { - {-case_id:required} -} { - Get the data for the case activity log. This version is cached for a single thread. - - @return a list of array-lists with the following entries: - comment comment_mime_type creation_date_pretty action_pretty_past_tense log_title - user_first_names user_last_name user_email creation_user data_arraylist - - @author Lars Pind -} { - set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] - set object_id [workflow::case::get_element -case_id $case_id -element object_id] - set contract_name [workflow::service_contract::activity_log_format_title] - - # Get the name of any title Tcl callback proc - set impl_names [workflow::get_callbacks \ - -workflow_id $workflow_id \ - -contract_name $contract_name] - - # First, we build up a multirow so we have all the data in memory, which lets us peek ahead at the contents - db_multirow -extend {comment} -local entries select_log {} { set comment $comment_string } - - - set rowcount [template::multirow -local size entries] - set counter 1 - - set last_entry_id {} - set data_arraylist [list] - - # Then iterate over the multirow to build up the activity log HTML - # We need to peek ahead, because this is an outer join to get the rows in workflow_case_log_data - - set entries [list] - template::multirow -local foreach entries { - - if { ![empty_string_p $key] } { - lappend data_arraylist $key $value - } - - if { $counter == $rowcount || ![string equal $last_entry_id [set "entries:[expr $counter + 1](entry_id)"]] } { - - set log_title_elements [list] - foreach impl_name $impl_names { - set result [acs_sc::invoke \ - -contract $contract_name \ - -operation "GetTitle" \ - -impl $impl_name \ - -call_args [list $case_id $object_id $action_id $entry_id $data_arraylist]] - if { ![empty_string_p $result] } { - lappend log_title_elements $result - } - } - set log_title [ad_decode [llength $log_title_elements] 0 "" "([join $log_title_elements ", "])"] - - set row [list] - foreach var { - comment comment_mime_type creation_date_pretty action_pretty_past_tense log_title - user_first_names user_last_name user_email creation_user data_arraylist - } { - lappend row $var [set $var] - } - lappend entries $row - - set data_arraylist [list] - } - set last_entry_id $entry_id - incr counter - } - - return $entries -} - -ad_proc workflow::case::get_notification_object { - {-type:required} - {-workflow_id ""} - {-case_id ""} -} { - Get the relevant object for this notification type. - - @param type Type is one of 'workflow_assignee', 'workflow_my_cases', - 'workflow_case' (requires case_id), and 'workflow' (requires - workflow_id). -} { - switch $type { - workflow_case { - if { ![exists_and_not_null case_id] } { - return {} - } - return [workflow::case::get_element -case_id $case_id -element object_id] - } - default { - if { ![exists_and_not_null workflow_id] } { - return {} - } - return [workflow::get_element -workflow_id $workflow_id -element object_id] - } - } -} - -ad_proc workflow::case::get_notification_request_url { - {-type:required} - {-workflow_id ""} - {-case_id ""} - {-return_url ""} - {-pretty_name ""} -} { - Get the URL to subscribe to notifications - - @param type Type is one of 'workflow_assignee', 'workflow_my_cases', - 'workflow_case' (requires case_id), and 'workflow' (requires - workflow_id). -} { - if { [ad_conn user_id] == 0 } { - return {} - } - - set object_id [get_notification_object \ - -type $type \ - -workflow_id $workflow_id \ - -case_id $case_id] - - if { [empty_string_p $object_id] } { - return {} - } - - if { ![exists_and_not_null return_url] } { - set return_url [util_get_current_url] - } - - set url [notification::display::subscribe_url \ - -type $type \ - -object_id $object_id \ - -url $return_url \ - -user_id [ad_conn user_id] \ - -pretty_name $pretty_name] - - return $url -} - -ad_proc workflow::case::get_notification_requests_multirow { - {-multirow_name:required} - {-label ""} - {-workflow_id ""} - {-case_id ""} - {-return_url ""} -} { - -} { - array set pretty { - workflow_assignee {my actions} - workflow_my_cases {my cases} - workflow_case {this case} - workflow {cases in this workflow} - } - - template::multirow create $multirow_name url label title - foreach type { - workflow_assignee workflow_my_cases workflow_case workflow - } { - set url [get_notification_request_url \ - -type $type \ - -workflow_id $workflow_id \ - -case_id $case_id \ - -return_url $return_url] - - if { ![empty_string_p $url] } { - set title "Subscribe to $pretty($type)" - if { ![empty_string_p $label] } { - set row_label $label - } else { - set row_label $title - } - template::multirow append $multirow_name $url $row_label $title - } - } -} - - - ##### # # workflow::case::fsm @@ -1139,17 +1219,18 @@ -case_id $case_id \ -action_id $action_id \ -entry_id $entry_id - - # Notifications - notify \ - -case_id $case_id \ - -action_id $action_id \ - -entry_id $entry_id \ - -comment $comment \ - -comment_mime_type $comment_mime_type + } workflow::case::flush_cache $case_id + + # Notifications + notify \ + -case_id $case_id \ + -action_id $action_id \ + -entry_id $entry_id \ + -comment $comment \ + -comment_mime_type $comment_mime_type return $entry_id } @@ -1206,38 +1287,38 @@ } { # Get workflow_id workflow::case::get \ - -case_id $case_id \ - -array case - + -case_id $case_id \ + -array case + workflow::get \ - -workflow_id $case(workflow_id) \ - -array workflow - + -workflow_id $case(workflow_id) \ + -array workflow + set hr [string repeat "=" 70] - + array set latest_action [lindex [workflow::case::get_activity_log_info -case_id $case_id] end] - set latest_action_chunk "$latest_action(action_pretty_past_tense) $latest_action(log_title) by $latest_action(user_first_names) $latest_action(user_last_name) ($latest_action(user_email))" + set latest_action_chunk "$latest_action(action_pretty_past_tense) [ad_decode $latest_action(log_title) "" "" "$latest_action(log_title) "]by $latest_action(user_first_names) $latest_action(user_last_name) ($latest_action(user_email))" if { ![empty_string_p $latest_action(comment)] } { append latest_action_chunk ":\n\n [join [split [ad_html_text_convert -from $latest_action(comment_mime_type) -to "text/plain" -maxlen 66 -- $latest_action(comment)] "\n"] "\n "]" } - + # Callback to get notification info set contract_name [workflow::service_contract::notification_info] set impl_names [workflow::get_callbacks \ -workflow_id $case(workflow_id) \ -contract_name $contract_name] # We only use the first callback set impl_name [lindex $impl_names 0] - + if { ![empty_string_p $impl_name] } { set notification_info [acs_sc::invoke \ -contract $contract_name \ -operation "GetNotificationInfo" \ -impl $impl_name \ -call_args [list $case_id $case(object_id)]] - + } # Make sure the notification info list has at least 4 elements, so we can do below lindex's safely @@ -1288,7 +1369,7 @@ set activity_log_chunk [workflow::case::get_activity_text -case_id $case_id] - set the_subject "[ad_decode $object_notification_tag "" "" "\[$object_notification_tag\] "]$object_one_line: $latest_action(action_pretty_past_tense) $latest_action(log_title) by $latest_action(user_first_names) $latest_action(user_last_name)" + set the_subject "[ad_decode $object_notification_tag "" "" "\[$object_notification_tag\] "]$object_one_line: $latest_action(action_pretty_past_tense) [ad_decode $latest_action(log_title) "" "" "$latest_action(log_title) "]by $latest_action(user_first_names) $latest_action(user_last_name)" # List of user_id's for people who are in the assigned_role to any enabled actions set assignee_list [db_list enabled_action_assignees {}] @@ -1353,8 +1434,6 @@ if { ![empty_string_p $object_id] } { - ns_log Notice "LARS: $body($type)" - set notified_list [concat $notified_list [notification::new \ -type_id [notification::type::get_type_id -short_name $type] \ -object_id $object_id \ Index: openacs-4/packages/workflow/tcl/case-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/case-procs.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/workflow/tcl/case-procs.xql 5 Mar 2003 17:18:10 -0000 1.6 +++ openacs-4/packages/workflow/tcl/case-procs.xql 28 Aug 2003 09:41:59 -0000 1.7 @@ -84,6 +84,33 @@ + + + insert into workflow_case_log_data + (entry_id, key, value) + values + (:entry_id, :key, :value) + + + + + + select value + from workflow_case_log_data + where entry_id = :entry_id + and key = :key + + + + + + select key, value + from workflow_case_log_data + where entry_id = :entry_id + order by key + + + select impl.impl_name Index: openacs-4/packages/workflow/tcl/implementation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/implementation-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/workflow/tcl/implementation-procs.tcl 5 Mar 2003 17:18:10 -0000 1.3 +++ openacs-4/packages/workflow/tcl/implementation-procs.tcl 28 Aug 2003 09:41:59 -0000 1.4 @@ -115,7 +115,6 @@ } { Return a subquery for all registered users. } { - ns_log Notice "LARS: getsubquery returning [db_map cc_users]" return [db_map cc_users] } Index: openacs-4/packages/workflow/tcl/install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/install-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/workflow/tcl/install-procs.tcl 5 Mar 2003 17:18:10 -0000 1.5 +++ openacs-4/packages/workflow/tcl/install-procs.tcl 28 Aug 2003 09:41:59 -0000 1.6 @@ -103,7 +103,7 @@ iscachable_p "t" } GetPrettyName { - description "Get the pretty name of this implementation. Will be localized, so i may contain #...#." + description "Get the pretty name of this implementation." output { pretty_name:string } iscachable_p "t" } @@ -136,7 +136,7 @@ iscachable_p "t" } GetPrettyName { - description "Get the pretty name of this implementation. Will be localized, so i may contain #...#." + description "Get the pretty name of this implementation." output { pretty_name:string } iscachable_p "t" } @@ -169,7 +169,7 @@ iscachable_p "t" } GetPrettyName { - description "Get the pretty name of this implementation. Will be localized, so it may contain #...#." + description "Get the pretty name of this implementation." output { pretty_name:string } iscachable_p "t" } @@ -202,8 +202,8 @@ iscachable_p "t" } GetPrettyName { - description "Get the pretty name of this implementation. Will be localized, so it may contain #...#." - output { object_type:string } + description "Get the pretty name of this implementation." + output { pretty_name:string } iscachable_p "t" } DoSideEffect { @@ -237,7 +237,7 @@ } GetPrettyName { description "Get the pretty name of this implementation. Will be localized, so it may contain #...#." - output { object_type:string } + output { pretty_name:string } iscachable_p "t" } GetTitle { @@ -275,7 +275,7 @@ } GetPrettyName { description "Get the pretty name of this implementation. Will be localized, so it may contain #...#." - output { object_type:string } + output { pretty_name:string } iscachable_p "t" } GetNotificationInfo { Index: openacs-4/packages/workflow/www/doc/developer-guide.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/doc/developer-guide.html,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/workflow/www/doc/developer-guide.html 5 Mar 2003 17:19:09 -0000 1.1 +++ openacs-4/packages/workflow/www/doc/developer-guide.html 28 Aug 2003 09:41:59 -0000 1.2 @@ -2,20 +2,67 @@ Package Developer's Guide to Workflow

        Package Developer's Guide to Workflow

        +Workflow Documentation : Package Developer's Guide + +
        +

        By Lars Pind

        Introduction

        -

        Workflow is used to coordinate the actions of multiple people -working together to accomplish something.

        +

        + The workflow package manages a collaborative process surrounding + some object. +

        +

        + Examples of the object could be a bug in a bug tracker, + a ticket in a ticket tracker, a content item in a content management + system, a user contribution in a moderated forum/comments/whatever + application, a user's request for particpation in a + course/event/whatever. +

        +

        For example, when a new bug is submitted, someone's assigned to fix it, and whoever submitted it is assigned to verify the fix and close the bug. Once the bug's fixed, the submitter will get notified, @@ -45,15 +92,1290 @@

      • Integrate workflow into your application's queries
      • + + +

        Let's first look at some concepts before getting into the +technicalities of how you actually do this. For a working example of +building workflow-based applications, we recommend you take a look at +bug-tracker.

        + +

        Workflow Concepts

        + +

        What's in a workflow

        + +

        + In its broadest, most conceptual sense, a workflow is defined as + (and this does get a little hairy, so feel free to skip if you just + want to start developing your applicaton): +

        + +
          +
        • + A number of actions that can + be executed (open, edit, comment, resolve, edit, publish, approve, + reject, etc.) Whether or not an action is enabled, meaning + it can be executed at this point in time, will depend on the + current state of the workflow. Executing an action may + change the state of the workflow. +
        • +
        • + A definition of the possible states that the + workflow can be in. This could simply be an enumeration of states, + such as "Open", "Resolved", "Closed", in which case we're talking + about a "Finite State Machine" (because there's a finite number of + possible states). Other models, such as petri nets, have an + infinite number of possible states. This makes things a lot more + complicated, and you don't need to bother since this first + implementation of workflow only supports finite state machines. +
        • +
        • + People participate in a workflow through their role. For a + bug tracker, the roles could be "Submitter", "Resolver", and + "Tester". For a publication workflow, they'd be "Author", "Editor", + and "Publisher". Actions will be to roles, which in turn will be + linked to users or groups of users in a particular workflow + case. The reason we link people to actions through the concept of + roles is to allow you to specify that two or more actions should + be done by the same party. In bug-tracker, for example, the same + user who opened the bug should also close it. +
        -

        Let's look at each of these in order.

        +

        Finite State Machines (FSMs)

        -

        Defining Your Process

        +

        + As mentioned, workflow is designed to support workflows based on any + model, however the only model currently implemented is the finite + state machine. +

        -

        Your process +

        + The workflow API is designed so that whenver you're using features + that are specific to finite state machines, the procedure name will + include the letters "fsm" in the name, as in workflow::case::fsm::get. That + way you'll know when you're hard-wiring a dependency on the + particular workflow model. +

        +

        + It's considered good practice to only use non-fsm API calls, but in + practice, it can be hard to create good user experiences without. So + feel free. +

        +
        + Notation: +

        + [Action] (State) {Role} +

        +

        + (State1) -> [Action1] -> (State2) -> [Action2] -> (State3) +

        +
        + + +

        Cases

        + +

        + So much for defining the workflow. When you start "running" your + workflow, that's called a workflow case, or simply a + case. A case is concerned with a particular object, it's always in a + particular state, and it has specific people or groups assigned to + its different roles. +

        + +

        In-flow and out-of-flow

        + +

        + When defining actions, we differentiate between in-flow and + out-of-flow. In-flow refers to the normal idealized flow of the + workflow, out-of-flow are the rest. Concretely what it means is that + if you're assigned to an in-flow action, we'll bug you about it + through notifications, and potentially get mad at you if you don't + come and do something to get the workflow moving along. We don't do + that with out-of-flow actions. So we'll send a notification that + says "Please come back and resolve this bug", whereas we'll not + notify everybody who are allowed to comment saying "Please come back + and comment on this bug". +

        + +

        + For bug-tracker, the normal flow (in-flow) is this: +

        + +
        + (Open) -> [Resolve] -> (Resolved) -> [Close] -> (Closed) +
        + +

        + Other actions not in the normal flow are [Edit] and [Comment], which + are always enabled, but never change the state. And [Reopen] which + throw you back to the (Open) state. And finally [Resolved] is + in-flow when in the (Open) state, but out-of-flow when in the + (Resolved) state, meaning that you can re-resolve a bug if you need + to, but you're not required to. +

        + +

        + In-flow and out-of-flow depends on the action, the state, and the + user's role in the case. For example, it might be that users in the + {Submitter} role are allowed to resolve their own bugs, but the + [Resolve] action will still only be considered in-flow to people in + the {Assignee} or {Resolver} role. +

        + +

        The Six Steps Conceptually

        + +

        + The recommended way a workflow is linked to an application is this: + As part of developing your application, you define your default + workflow, which will be used as a template for customization by the + users of your applications. This workflow will be installed using + the APM after-install callback, and will be linked to your + application's package-key. +

        + +

        + Then when a new instance of your application is created, your + default workflow will be cloned, and the clone linked to the + new instance, so that your users can customize the workflow for each + instance of your application individually. The default copy + installed along with your package is never actually used except for + cloning when creating a new instance. This means that your users can + customize this deafult workflow, and the modified version will serve + as the boilerplate for all new package instances. +

        + +

        + In order to integrate workflow with your application, you'll want to + implement one or more of the callback service + contracts. These can do things like determine default assignees + based on certain data in your application, get information about + your application's object for use when sending out notifications, or + perform side-effects, such as actually changing the publication + state of a content item when you execute the [Publish] action. +

        + +

        + When integrating the workflow with your application's user + experience, what workflow will give you is essentially the list of + actions that the given user can perform on the given object at the + given time. In bug-tracker, for example, bug-tracker takes care of + displaying the form displaying and editing a bug, while workflow + takes care of displaying the buttons that say [Comment], [Edit], + [Resolve], [Reopen], [Close], etc., along the bottom of the + form. Workflow also has a place to store which form elements should + be opened for editing depending on the action being executed. +

        + +

        + Your application should typically have an API for creating a new + object, editing an object, etc. This application object API will + need to be workflow-aware, so when a new object is created, a + new workflow case will be started as well. And when the object's + edited, that should generally only happen through a workflow action, + so that needs to be taken into account as well. +

        + +

        + The final step is integrating workflow into your application's + queries when you want to filter an object listing/count based on + the workflow state. This is the only place where you'll directly + be dependent on the workflow data model. +

        + + +

        Defining Your Process (FSM)

        + +

        + The current version of workflow only supports workflows based on a + finite state machine (FSM). Support for other models, such as petri + nets and directed graphs are possible, but not currently designed or + implemented. +

        + +

        + An FSM-based workflow consists of a set of states, actions, and roles. +

        + +

        + You define a new workflow like this: +

        + +
        +set spec {
        +    workflow-short-name {
        +        ...
        +        roles {
        +            role-short-name {
        +               ...
        +            }
        +            ...
        +        }
        +        states {
        +            state-short-name {
        +               ...
        +            }
        +            ...
        +        }
        +        actions {
        +            action-short-name {
        +               ...
        +            }
        +            ...
        +        }
        +    }
        +}
        +
        +set workflow_id [workflow::fsm::new_from_spec -spec $spec]
        +
        + +

        + All the items (workflow, roles, states, actions) have a short-name, + which should be lowercase and use underbar (_) instead of + spaces. These are mainly used to refer to the items in other parts + of the spec. +

        + +

        + The workflow short name can be used to refer to the + workflow in your application, which is useful if you have several + different workflows. The bug-tracker, for example, could have a + workflow for bugs and another one for patches. +

        + +

        + Finally, you can also refer states, roles, and actions in your + application using short names, although this creates a dependency in + your application on a particular form of the workflow, and there's + currently no mechanism for ensuring that your workflow contains the + states, roles, and actions you'd refer to. This is on the todo-list. +

        + +

        Workflow

        + +

        + These are the attributes you can specify for the workflow itself: +

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Workflow Attributes
        AttributeDescription
        pretty_name + Name used in the user interface. +
        package_key + The package that defined this workflow. +
        object_type + The parent object type which this workflow can be applied + to. If your workflow applies to any object, say 'acs_object'. + This is used in relation to callbacks when we build + the user interface for defining workflows. More on this in the + section on callbacks. +
        callbacks + Callbacks that apply to the whole workflow. If you add + side-effect callbacks, these are executed every time any action + is executed. +
        roles + Denotes the section of the spec that defines the workflow's roles. +
        states + Denotes the section of the spec that defines the workflow's states. +
        actions + Denotes the section of the spec that defines the workflow's actions. +
        + +
        + Internationalization Note: +

        + When we make workflow internationalized for OpenACS 5.0, pretty + names will contain message keys in the form + "#message-key#". More about this in the package developer's + guide to internationalization. +

        +
        + +

        Roles

        + +

        + Attributes for roles: +

        + + + + + + + + + + + + + + + + + +
        Role Attributes
        AttributeDescription
        pretty_name + Name used in the user interface. +
        callbacks + Callbacks that define how assignment of this role to users is done. +
        + + +

        States

        + +

        + A few typical examples of states: +

        + + + + + + + + + + + + + + + + + + + + + + + + + +
        Examples of States
        ApplicationStates
        Ticket Tracker + (Open),(Completed), and (Closed) +
        Bug Tracker + (Open), (Triaged), (Resolved), and (Closed) +
        Content Management System Publication + (Authored), (Edited), and (Published) +
        Simple Approval + (Requested), (Approved), and (Rejected) +
        + +

        + These are the state attributes in the workflow specification: +

        + + + + + + + + + + + + + + + + + +
        State Attributes
        AttributeDescription
        pretty_name + Name used in the user interface. +
        hide_fields + A tcl list of form elements/object attributes that don't make + sense in this state. In bug-tracker, the element "Fixed in + version" doesn't make sense when the bug is (Open), and thus not + yet fixed. It's currently up to your application to do + incorporate this into your application. +
        + + +

        Actions

        + +

        + Actions are what the workflow allows you to do to your object. +

        + +
        + Terminology: +
        +
        Enabled
        +
        + The action is allowed to be executed in the workflow's current state. +
        +
        Allowed
        +
        + The given user is allowed to execute the action given his + current relationship to the workflow case and the object. +
        +
        Assigned
        +
        + The same as allowed, but the action is in-flow for this user. +
        +
        Available
        +
        + The action is both enabled and allowed for this user. +
        +
        +
        + +

        + Some actions will always be enabled. In bug-tracker, for + example, we have [Comment] and [Edit] actions, which are always + allowed, regardless of whether the bug is (Open), (Resolved), or + (Closed). +

        + +

        + Other actions, however, will only be enabled in certain + states. In bug-tracker, for example, the [Close] action is only + available in the (Resolved) state. +

        + +

        + Another distinction is that some actions change the state, and + others do not. [Comment] and [Edit], for example, do + not. [Resolve], [Close], and [Reopen] do. For an FSM, when an action + changes the state, you simply specify what the new state should be. +

        + +

        + There's a special action called the initial action. This is + implicitly executed when a new case is started for this workflow, + and must always specify the "new_state" attribute to define which + state new cases start out in. +

        + +

        + Attributes for actions: +

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Action Attributes
        AttributeDescription
        pretty_name + Name used in the user interface. +
        pretty_past_tense + This is used in the case log to say "<pretty_past_teense> + by <user> on <date>", for example "Resolved by Jeff + Davis on April 15, 2003". +
        new_state + The short_name of the state this action puts the case + into. Leave out if the action shouldn't change the state. +
        initial_action_p + Say 't' if this is the initial action. Leave out or set to 'f' otherwise. +
        allowed_roles + A list of roles that are allowed but not assigned to perform this action. +
        assigned_role + A single role which is assigned to this action. +
        privileges + A list of privileges. Users who have been granted one of these + privileges on the case's object will be allowed to execute this action. +
        always_enabled_p + Say 't' if this action should be enabled regardless of the + case's current state. Say 'f' or leave out otherwise. +
        enabled_states + If not always enabled, enumerate the states in which this action + is enabled but not assigned. +
        assigned_states + Enumerate the states in which this action + is enabled and assigned. +
        edit_fields + A tcl list of fields which should be opened for editing when the + user is performing this action. Again, it's up to the application + to act on this. +
        callbacks + Side-effect callbacks which are executed when this action is executed. +
        + +

        Putting A Workflow Together

        + +

        + When you put this all together, here's a real live example of what + defining a workflow could look like: +

        + +
        +ad_proc -private bug_tracker::bug::workflow_create {} {
        +    Create the 'bug' workflow for bug-tracker
        +} {
        +    set spec {
        +        bug {
        +            pretty_name "Bug"
        +            package_key "bug-tracker"
        +            object_type "bt_bug"
        +            callbacks { 
        +                bug-tracker.FormatLogTitle 
        +                bug-tracker.BugNotificationInfo
        +            }
        +            roles {
        +                submitter {
        +                    pretty_name "Submitter"
        +                    callbacks { 
        +                        workflow.Role_DefaultAssignees_CreationUser
        +                    }
        +                }
        +                assignee {
        +                    pretty_name "Assignee"
        +                    callbacks {
        +                        bug-tracker.ComponentMaintainer
        +                        bug-tracker.ProjectMaintainer
        +                        workflow.Role_PickList_CurrentAssignees
        +                        workflow.Role_AssigneeSubquery_RegisteredUsers
        +                    }
        +                }
        +            }
        +            states {
        +                open {
        +                    pretty_name "Open"
        +                    hide_fields { resolution fixed_in_version }
        +                }
        +                resolved {
        +                    pretty_name "Resolved"
        +                }
        +                closed {
        +                    pretty_name "Closed"
        +                }
        +            }
        +            actions {
        +                open {
        +                    pretty_name "Open"
        +                    pretty_past_tense "Opened"
        +                    new_state "open"
        +                    initial_action_p t
        +                }
        +                comment {
        +                    pretty_name "Comment"
        +                    pretty_past_tense "Commented"
        +                    allowed_roles { submitter assignee }
        +                    privileges { read write }
        +                    always_enabled_p t
        +                }
        +                edit {
        +                    pretty_name "Edit"
        +                    pretty_past_tense "Edited"
        +                    allowed_roles { submitter assignee }
        +                    privileges { write }
        +                    always_enabled_p t
        +                    edit_fields { 
        +                        component_id 
        +                        summary 
        +                        found_in_version
        +                        role_assignee
        +                        fix_for_version
        +                        resolution 
        +                        fixed_in_version 
        +                    }
        +                }
        +                reassign {
        +                    pretty_name "Reassign"
        +                    pretty_past_tense "Reassigned"
        +                    allowed_role { submitter assignee }
        +                    privileges { write }
        +                    enabled_states { resolved }
        +                    assigned_states { open }
        +                    edit_fields { role_assignee }
        +                }
        +                resolve {
        +                    pretty_name "Resolve"
        +                    pretty_past_tense "Resolved"
        +                    assigned_role "assignee"
        +                    enabled_states { resolved }
        +                    assigned_states { open }
        +                    new_state "resolved"
        +                    privileges { write }
        +                    edit_fields { resolution fixed_in_version }
        +                    callbacks { bug-tracker.CaptureResolutionCode }
        +                }
        +                close {
        +                    pretty_name "Close"
        +                    pretty_past_tense "Closed"
        +                    assigned_role "submitter"
        +                    assigned_states { resolved }
        +                    new_state "closed"
        +                    privileges { write }
        +                }
        +                reopen {
        +                    pretty_name "Reopen"
        +                    pretty_past_tense "Reopened"
        +                    allowed_roles { submitter }
        +                    enabled_states { resolved closed }
        +                    new_state "open"
        +                    privileges { write }
        +                }
        +            }
        +        }
        +    }
        +
        +    set workflow_id [workflow::fsm::new_from_spec -spec $spec]
        +    
        +    return $workflow_id
        +}
        +
        + + +

        Defining Callbacks

        + +

        + There are a number of different types of callbacks, each of which applies to + different workflow items (workflows, roles, states, actions). They're all + defined as service contracts. +

        + +

        + In order to make use of them, your application will need to + implement these service contracts, and register the implementation + with the relevant workflow item through the 'callbacks' attribute in + the spec above. +

        + +

        + Here are the types of callbacks defined, how they're used, and the + workflow items they apply to. +

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Service contracts
        Service ContractApplies ToDescription
        Workflow.Role_DefaultAssignees + Roles + + Used to get the default assignees for a role. Called for all + roles when a case is started. Also called for roles with no + assignees, when that role is assigned to an action. Should return a + list of party_id's. +
        Workflow.Role_AssigneePickList + Roles + + Used when the users wants to reassign a role to populate a + drop-down list of the most likely users/groups to assign this role + to. Should return less than 25 users/groups. Should return a + list of party_id's. +
        Workflow.Role_AssigneeSubQuery + Roles + + A subquery used to limit the scope of the user's search for a + new assignee for a role. Could typically be used to limit the + search to members of a particular group, organizers of a + particular event, etc. +

        + Should return a subquery ready to be + included in the from-clause of a query, which will be used when + querying for users, for example '(select * from parties where + ...)', (sub-selects must be in parenthesis), or simply + 'cc_users' or 'parties'. Defaults to 'cc_users'. +

        Workflow.Action_SideEffect + Workflows, Actions + + This is executed whenever the given action is executed. If + specified for the workflow, it will be executed whenever any + action is executed on the workflow. For details about how to use + this in conjunction with log entry data and format log title, + see below. +

        + Side-effects are executed after the application object has been + updated, after the workflow state has been changed, after the + log entry has been crated, and roles assigned, but before + notifications have been sent out. +

        Workflow.ActivityLog_FormatTitle + Workflows + + Used to format the title of the case log. In bug-tracker, this + is used to get the resolution code displayed in the case log as + "Resolved (Fixed)" or "Resolved (Not Reproducable)". +

        + The implementation should return the text string that should go + into the parenthesis. The parenthesis are automatically added + if the returned string is non-empty. +

        Workflow.NotificationInfo + Workflows + + Allows the application to supply information about the case + object for the notification. +

        + + Should return the notification information as a 4-element list + containing: +

          +
        1. url +
        2. one-line summary +
        3. details about the object in + the form of an array-list with label/value +
        4. tag for the notification subject (optional). If present, + it will be put inside brackets []. +
        +
        + +

        + All the service contracts have 3 operations each. The first two are + the same for all service contracts, and they really just act like + static variables: +

        + + + + + + + + + + + + + + + + + + + + + + + +
        Common service contract operations
        OperationInputOutputDescription
        GetObjectType + None + + object_type:string + + Get the object type for which this implementation is valid. If + your implementation is valid for any object, return + 'acs_object', otherwise return the object type. +
        GetPrettyName + None + + pretty_name:string + + Get the pretty name of this implementation. This will be used in + the user interface to let the workflow designer pick which + implementation to use. +
        + +

        + The third operation is the one that does the real work. Here are the + inputs and outputs: +

        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Specific service contract operations
        ContractOperationInputOutput
        + Workflow.Role_DefaultAssignees + + GetAssignees + + case_id:integer
        + object_id:integer
        + role_id:integer +
        + party_ids:integer,multiple +
        Workflow.Role_AssigneePickList + GetPickList + + case_id:integer
        + object_id:integer
        + role_id:integer +
        + party_ids:integer,multiple +
        Workflow.Role_AssigneeSubQuery + GetSubquery + + case_id:integer
        + object_id:integer
        + role_id:integer +
        + subquery:string +
        Workflow.Action_SideEffect + DoSideEffect + + case_id:integer + object_id:integer + action_id:integer + entry_id:integer + + None +
        Workflow.ActivityLog_FormatTitle + GetTitle + + case_id:integer + object_id:integer + action_id:integer + entry_id:integer + data_arraylist:string,multiple + + title:string +
        Workflow.NotificationInfo + GetNotificationInfo + + case_id:integer + object_id:integer + + info:string,multiple +
        + +

        + For the most up-to-date information about the service contracts, + your safest bet is to refer to the user-visible pages of the + acs-service-contract package itself, which will let you view your + currently installed contracts and implementations. +

        + +

        Log Entry Data and Log Entry Titles

        + +

        + One noteworthy thing that side-effects can be used for, is to + record information about a log entry for use later in displaying a + more detailed log entry title, or can be used to e.g. tie a workflow + log entry to a particular content repository revision, etc. +

        + +

        + Using workflow::case::add_log_data, you can add arbitrary key/value + pairs to a log entry. These can the be retrieved later using + workflow::case::get_log_data_by_key, and workflow::case::get_log_data. +

        + + +

        Installing and Instantiating (APM Tcl Callbacks)

        + +

        + Here are the workflow-related operations that you'll typically want + your application to do from the APM Tcl Callbacks: +

        + +
        +
        after-install
        +
        + +
        + +
        before-uninstall
        +
        +
          +
        • Delete default workflow (workflow::delete) +
        • Unregister service contract implementations +
        +
        + +
        before-upgrade
        +
        +
          +
        • Add new service contract implementations +
        • Add new workflows +
        • Make changes to existing default workflows (if the installed + verison is not modified) (this isn't yet supported on the workflow API) +
        +
        + +
        after-instantiate
        +
        +
          +
        • + Clone default workflow to create a new workflow attached to + the instance (workflow::fsm::clone) +
        • +
        +
        + +
        before-uninstantiate
        +
        + +
        +
        + +

        + To see what this could look like in practice, check out + packages/bug-tracker/tcl/install-procs.tcl. +

        + + +

        Integrating With Your Application's API

        + +

        + Newer applications will define a namespace for each of the objects + it defines, which will contain procs like "get", "new", "delete", + etc., to manipulate these objects. +

        + +

        + Given such a setup, here are the procs that you want to integrate + workflow into for your workflow-integrated objects. For a real-life + example, see packages/bug-tracker/tcl/bug-procs.tcl and + search for "workflow::". +

        + +
        +
        get
        +
        + In addition to your application's object data, you'll want to call + workflow::case::get_id to get the case_id for your + object, and then either workflow::case::get or + workflow::case::fsm::get in order to get state + information from workflow to include in the data set returned by + your API proc. +
        + +
        new
        +
        + When creating a new object, you should also start a new workflow + case for that object using workflow::case::new. +
        + +
        edit
        +
        + Editing an object should only happen through a workflow action, if + you want to have a complete audit log (workflow case log). Thus, + your edit proc should take the following arguments, in addition to + the object_id and the array containing the object data: +
        +      -action_id:required
        +      -comment:required
        +      -comment_format:required
        +      {-entry_id {}}
        +    
        + (entry_id is for double-click protection). +

        + First, you should update your application object data as normal. + Then you'll probably want to use + workflow::case::get_id to find the case_id. If you + have assignment integrated in your form, you'll want to call + workflow::case::role::assign to pass these on to + workflow, and finally you'll say + workflow::case::action::execute to execute the + action, including state changes, side-effects, and notifications. +

        +
        + +

        Integrating With Your Application's User Interface

        + +

        + Usually, you'll want one page that lists all the objects in your + package instance, and another that lets the user view/edit one + object, called the object form page. This section is about the + object form page, the next section is about the object listing page. +

        + +

        + For a real-life example, look at + packages/bug-tracker/www/bug.tcl. You may want to have + that handy while reading through this. +

        + +

        + We're hoping to make some streamlining of both ad_form and workflow + to make this form page integration even easier at some point. But no promises. +

        + +

        + Use workflow::case::get_id to get the case_id. +

        + +

        + If you want buttons along the bottom of the form like bug-tracker, + use the new 'action' feature of the form builder. What you do is + pass a list of possible actions to the form builder as a + list-of-lists with { label value }. These will be + displayed as buttons at the bottom of the form. +

        + +

        + When one of these buttons are clicked, the form will be in + edit-mode, and you can use form get_action to get the + value of the action chosen. +

        + +

        + So up top, you'll want to ask the form if an action is in progress, + and which one it is, by saying set action_id [form get_action + form-id]. If no action is in progress this will return + the empty string. +

        + +

        + Then you should check that this action is currently available to + this user by saying + workflow::case::action::available_p. +

        + +

        + To get the currently available actions so you can offer them to the + user, use workflow::case::get_available_actions which + will return the action_id's, then workflow::action::get + to get the details about each of the actions. +

        + +

        + If you're using ad_form, and you want only one assignee + per role, and you want assignment integrated with your form, use + workflow::case::role::add_assignee_widgets to add the + widgets. It'll do an ad_form -extend, so they'll appear + at the point at which you call this proc. +

        + +

        + To set the editable fields as defined for the action, do this: +

        + +
        +if { ![empty_string_p $action_id] } {
        +    foreach field [workflow::action::get_element -action_id $action_id -element edit_fields] { 
        +	element set_properties bug $field -mode edit 
        +    }
        +}
        +
        + +

        + Similarly, on submit, you'll want to set the value of the editable fields. +

        + +

        + To populate values of the assignee widgets, use + workflow::case::role::set_assignee_values in your + on_request block. +

        + +

        + To add the case log to the comment field, use + workflow::case::get_activity_html and feed it to the + before_html property of a textarea. +

        + + +

        Integrating With Your Application's Queries

        + +

        + Here's an example of how the bug-tracker integrates with workflow + for nformation about the current state of bugs. +

        + +
        +select b.bug_id,
        +       ...
        +
        +       st.pretty_name as pretty_state,
        +       st.short_name as state_short_name,
        +       st.state_id,
        +       st.hide_fields,
        +
        +       assignee.party_id as assignee_party_id,
        +       assignee.email as assignee_email,
        +       assignee.name as assignee_name
        +
        +from   bt_bugs b,
        +       workflow_cases cas left outer join
        +       (select rpm.case_id,
        +               p.party_id,
        +               p.email,
        +               acs_object__name(p.party_id) as name
        +          from workflow_case_role_party_map rpm,
        +               parties p
        +         where rpm.role_id = :action_role
        +           and p.party_id = rpm.party_id
        +         ) assignee on (cas.case_id = assignee.case_id),
        +       workflow_case_fsm cfsm,
        +       workflow_fsm_states st 
        +where  cas.workflow_id = :workflow_id
        +and    cas.object_id = b.bug_id
        +and    cfsm.case_id = cas.case_id
        +and    st.state_id = cfsm.current_state
        +and    b.project_id = :package_id
        +order  by $order_by_clause
        +
        + +

        + Note the outer join to get the assignee(s). The joins to get + information about the current state is straight-forward. +

        + +

        Good Luck!

        + +

        + That's all I think you'll need to know to start developing + workflow-enabled applications. +

        + +

        + Let me know how it goes, or of something's missing, by posting on + the OpenACS Forums. +

        +
        lars@pinds.com
        Index: openacs-4/packages/workflow/www/doc/index.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/doc/index.html,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/workflow/www/doc/index.html 5 Mar 2003 17:19:09 -0000 1.1 +++ openacs-4/packages/workflow/www/doc/index.html 28 Aug 2003 09:41:59 -0000 1.2 @@ -2,17 +2,21 @@ Workflow Documentation

        Workflow Documentation

        +Workflow Documentation + +
        +

        By Lars Pind

        -
        -

        The workflow package provides a service to keep track of a process involving multiple people around some object. Workflow keeps track @@ -37,10 +41,84 @@

        This is the document we wrote before implementing workflow specifying - how we intended to implement the package then. + how we intended to implement the package then. It is inaccurate in a + number of places where reality forced us to make changes.
        +

        Version History

        + +
          +
        • + 1.0d4 Resolved conflicts with old acs-workflow package, so they install side by side. (May 11, 2003) +
        • +
        • + 1.0d3 Added Tcl API workflow::case::delete ; + fixed bug in PL/SQL implementation of workflow_case.delete/workflow_case__delete ; + added @see to workflow::case::insert. +
        • +
        • + 1.0d2 Completed package developer's guide. Added -action_id + switch to workflow::case::get_activity_html.
        • + +
        • + 1.0d1 Bumped up the version number to 1.0 to reflect the + fact that this package is actually at a steady state and fully + useful as is. Also added a little API and cleaned up things a bit, + the kind of things you learn while writing the documentation. +
        • + +
        • + 0.2d2 First version released along with OpenACS 4.6.2. +
        • +
        + +

        Todo

        + +
          +
        • + Internationalization. +
        • +
        • + Add API for modifying live workflows, including ensuring that the modifications are + always safe (i.e. you can't delete a state that's used.) +
        • +
        • + Add a user interface for defining workflows. +
        • +
        • + Add a user interface for monitoring workflows and bulk changing + the state of workflows. +
        • +
        • + Periodically notify people of their outstanding assigned actions. +
        • +
        • + Add a task list user interface, either as part of the Workflow package, or as a separate pacakge. +
        • +
        • + Add support for petri nets and other models. +
        • +
        • + Add timing of actions, deadlines, and integrate those with calendar. +
        • +
        • + Application integration with certain states and actions. For + example, in bug-tracker, we treat the "Open" and "Closed" states + specially. We also treat the "Resolve" action specially. Should be + possible to define this link. +
        • +
        • + Add workflow variants, so you can ship your application with + multiple default implementations of the same workflow and let the + user choose between the available variants (e.g. simple approval + vs. multiple approval variants, choice of triage and Q&A steps in + the bug-tracker, etc.). This should probably be tied to some + concept of an 'application' as in the bullet above. +
        • +
        + +
        lars@pinds.com
        Index: openacs-4/packages/workflow/www/doc/specification.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/doc/specification.html,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/workflow/www/doc/specification.html 5 Mar 2003 17:19:09 -0000 1.1 +++ openacs-4/packages/workflow/www/doc/specification.html 28 Aug 2003 09:41:59 -0000 1.2 @@ -1,9 +1,18 @@ -Workflow Specification +Workflow Functional Specification + -

        Workflow Specification

        +

        Workflow Functional Specification

        +Workflow Documentation : Functional Specification + +
        +

        By Lars Pind

        @@ -158,7 +167,7 @@

        - A workflow is associated with an oject, which would typically be one + A workflow is associated with an object, which would typically be one of the following:

        Index: openacs-4/packages/wp-slim/wp-slim.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/wp-slim.info,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/wp-slim/wp-slim.info 17 May 2003 12:49:05 -0000 1.11 +++ openacs-4/packages/wp-slim/wp-slim.info 28 Aug 2003 09:41:59 -0000 1.12 @@ -6,191 +6,24 @@ Wimpy Points f f - - + + oracle postgresql - Jack Purswani -and Sidharth Widge(Porter) - Paul Konigsberg - Haolan Qin + Rocael Hernandez Rizzardini Wimpy Point allows users to collaborate and share online presentations. - 2001-01-26 - ArsDigita Corporation - Ported (Jack). Fixed several bugs. Added new features (e.g. versioning and authorization). + 2003-08-07 + Openacs + Scalability test, permission revision, enhancements from WPII and other features added (Rocael). Ported (Jack). Fixed several bugs. Added new features (e.g. versioning and authorization). - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Index: openacs-4/packages/wp-slim/sql/oracle/upgrade-4.0b-4.0b1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/oracle/Attic/upgrade-4.0b-4.0b1.sql,v diff -u -N --- openacs-4/packages/wp-slim/sql/oracle/upgrade-4.0b-4.0b1.sql 15 Nov 2001 01:47:13 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,1178 +0,0 @@ --- add a (possibly) new mime type -insert into cr_mime_types (mime_type) -select 'application/octet-stream' -from dual -where not exists (select 1 from cr_mime_types where mime_type = 'application/octet-stream'); - - --- users with wp_admin_presentaiton privilege can access --- authorization pages -begin - acs_privilege.create_privilege('wp_admin_presentation'); -end; -/ -show errors - - --- add a parent_id column in all of the auxiliary tables for clobs so that we can keep --- track of all revisions of a specific presentation or slide. -alter table cr_wp_presentations_aud add ( - presentation_id integer - constraint cr_wp_paudience_pid_nn - not null - constraint cr_wp_paudience_pid_fk - references cr_wp_presentations -); - -alter table cr_wp_presentations_back add ( - presentation_id integer - constraint cr_wp_pbackground_pid_nn - not null - constraint cr_wp_pbackground_pid_fk - references cr_wp_presentations -); - -alter table cr_wp_slides_preamble add ( - slide_id integer - constraint cr_wp_spreamble_sid_nn - not null - constraint cr_wp_spreamble_sid_fk - references cr_wp_slides -); - -alter table cr_wp_slides_postamble add ( - slide_id integer - constraint cr_wp_spostamble_sid_nn - not null - constraint cr_wp_spostamble_sid_fk - references cr_wp_slides -); - -alter table cr_wp_slides_bullet_items add ( - slide_id integer - constraint cr_wp_sbullet_sid_nn - not null - constraint cr_wp_sbullet_sid_fk - references cr_wp_slides -); - --- add the correspondent attributes -declare - attr_id acs_attributes.attribute_id%TYPE; -begin - - attr_id := content_type.create_attribute ( - content_type => 'cr_wp_presentation_aud', - attribute_name => 'presentation_id', - datatype => 'integer', - pretty_name => 'Prsentation ID', - pretty_plural => 'Presentation IDs', - column_spec => 'integer' - ); - - attr_id := content_type.create_attribute ( - content_type => 'cr_wp_presentation_back', - attribute_name => 'presentation_id', - datatype => 'integer', - pretty_name => 'Prsentation ID', - pretty_plural => 'Presentation IDs', - column_spec => 'integer' - ); - - attr_id := content_type.create_attribute ( - content_type => 'cr_wp_slide_preamble', - attribute_name => 'slide_id', - datatype => 'integer', - pretty_name => 'Slide ID', - pretty_plural => 'Slide IDs', - column_spec => 'integer' - ); - - attr_id := content_type.create_attribute ( - content_type => 'cr_wp_slide_postamble', - attribute_name => 'slide_id', - datatype => 'integer', - pretty_name => 'Slide ID', - pretty_plural => 'Slide IDs', - column_spec => 'integer' - ); - - attr_id := content_type.create_attribute ( - content_type => 'cr_wp_slide_bullet_items', - attribute_name => 'slide_id', - datatype => 'integer', - pretty_name => 'Slide ID', - pretty_plural => 'Slide IDs', - column_spec => 'integer' - ); -end; -/ -show errors - - - - --- add a public_p column -alter table cr_wp_presentations -add ( - public_p char(1) default 'f' - constraint cr_wp_public_p_ck - check(public_p in ('t','f')) -); - --- create a public_p attribute -declare - attr_id acs_attributes.attribute_id%TYPE; -begin - attr_id := content_type.create_attribute ( - content_type => 'cr_wp_presentation', - attribute_name => 'public_p', - datatype => 'boolean', - pretty_name => 'Public Flag', - pretty_plural => 'Public Flags', - column_spec => 'char(1)' - ); -end; -/ -show errors - --- public_p added. delete_audience and delete_background added. --- get_audience_revision and get_background_revision added. -create or replace package wp_presentation -as - function new ( - 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, - pres_title in cr_wp_presentations.pres_title%TYPE, - page_signature in cr_wp_presentations.page_signature%TYPE, - copyright_notice in cr_wp_presentations.copyright_notice%TYPE, - style in cr_wp_presentations.style%TYPE default -1, - public_p in cr_wp_presentations.public_p%TYPE default 'f', - show_modified_p in cr_wp_presentations.show_modified_p%TYPE default 'f', - audience in varchar2, - background in varchar2 - ) return cr_items.item_id%TYPE; - - procedure delete_audience ( - audience_item_id in cr_items.item_id%TYPE - ); - - procedure delete_background ( - background_item_id in cr_items.item_id%TYPE - ); - - procedure delete ( - pres_item_id in cr_items.item_id%TYPE - ); - - function get_audience ( - pres_item_id in cr_items.item_id%TYPE - ) return blob; - - function get_audience_revision ( - pres_revision_id in cr_revisions.revision_id%TYPE - ) return blob; - - function get_background ( - pres_item_id in cr_items.item_id%TYPE - ) return blob; - - function get_background_revision ( - pres_revision_id in cr_revisions.revision_id%TYPE - ) return blob; - - procedure new_revision ( - 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, - pres_item_id in cr_items.item_id%TYPE, - pres_title in cr_wp_presentations.pres_title%TYPE, - page_signature in cr_wp_presentations.page_signature%TYPE, - copyright_notice in cr_wp_presentations.copyright_notice%TYPE, - style in cr_wp_presentations.style%TYPE, - public_p in cr_wp_presentations.public_p%TYPE, - show_modified_p in cr_wp_presentations.show_modified_p%TYPE, - audience in varchar2, - background in varchar2 - ); - -end wp_presentation; -/ -show errors - - --- public_p added. delete_audience and delete_background added. presentation_id in clobs table added. --- get_audience_revision and get_background_revision added. -create or replace package body wp_presentation -as - function new ( - 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, - pres_title in cr_wp_presentations.pres_title%TYPE, - page_signature in cr_wp_presentations.page_signature%TYPE, - copyright_notice in cr_wp_presentations.copyright_notice%TYPE, - style in cr_wp_presentations.style%TYPE default -1, - public_p in cr_wp_presentations.public_p%TYPE, - show_modified_p in cr_wp_presentations.show_modified_p%TYPE default 'f', - audience in varchar2, - background in varchar2 - ) return cr_items.item_id%TYPE - is - v_item_id cr_items.item_id%TYPE; - v_audience_item_id cr_items.item_id%TYPE; - v_background_item_id cr_items.item_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; - v_audience_revision_id cr_revisions.revision_id%TYPE; - v_background_revision_id cr_revisions.revision_id%TYPE; - v_max_id integer; - v_name cr_wp_presentations.pres_title%TYPE; - begin - -- (name, parent_id) must be unique. For type cr_wp_presentation, - -- name has to be unique because parent_id is null. - - select nvl(max(item_id),0) into v_max_id - from cr_items - where content_type = 'cr_wp_presentation' - and name like new.pres_title || '%'; - - v_name := new.pres_title || '_' || v_max_id; - - v_item_id := content_item.new( - name => v_name, - content_type => 'cr_wp_presentation', - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - v_revision_id := content_revision.new( - item_id => v_item_id, - title => '', - data => null, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - content_item.set_live_revision(v_revision_id); - - insert into cr_wp_presentations - ( - presentation_id, - pres_title, - page_signature, - copyright_notice, - style, - public_p, - show_modified_p - ) - values - ( - v_revision_id, - new.pres_title, - new.page_signature, - new.copyright_notice, - new.style, - new.public_p, - new.show_modified_p - ); - - v_audience_item_id := content_item.new( - name => 'audience', - parent_id => v_item_id, - content_type => 'cr_wp_presentation_aud', - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - v_audience_revision_id := content_revision.new( - item_id => v_audience_item_id, - title => '', - text => audience, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - content_item.set_live_revision(v_audience_revision_id); - - insert into cr_wp_presentations_aud - ( - id, - presentation_id - ) - values - ( - v_audience_revision_id, - v_revision_id - ); - - v_background_item_id := content_item.new( - name => 'background', - parent_id => v_item_id, - content_type => 'cr_wp_presentation_back', - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - v_background_revision_id := content_revision.new( - item_id => v_background_item_id, - title => '', - text => background, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - content_item.set_live_revision(v_background_revision_id); - - insert into cr_wp_presentations_back - ( - id, - presentation_id - ) - values - ( - v_background_revision_id, - v_revision_id - ); - - return v_item_id; - end; - - - procedure delete_audience ( - audience_item_id in cr_items.item_id%TYPE - ) - is - begin - delete from cr_wp_presentations_aud - where exists (select 1 from cr_revisions where revision_id = cr_wp_presentations_aud.id and item_id = audience_item_id); - - delete from cr_item_publish_audit - where item_id = audience_item_id; - - content_item.delete(audience_item_id); - end; - - procedure delete_background ( - background_item_id in cr_items.item_id%TYPE - ) - is - begin - delete from cr_wp_presentations_back - where exists (select 1 from cr_revisions where revision_id = cr_wp_presentations_back.id and item_id = background_item_id); - - delete from cr_item_publish_audit - where item_id = background_item_id; - - content_item.delete(background_item_id); - end; - - procedure delete ( - pres_item_id in cr_items.item_id%TYPE - ) - is - v_audience_item_id cr_items.item_id%TYPE; - v_background_item_id cr_items.item_id%TYPE; - cursor v_slide_cursor is - select item_id as slide_item_id - from cr_items - where content_type = 'cr_wp_slide' - and parent_id = pres_item_id; - begin - for c in v_slide_cursor loop - wp_slide.delete(c.slide_item_id); - end loop; - - select item_id into v_audience_item_id - from cr_items - where content_type = 'cr_wp_presentation_aud' - and parent_id = pres_item_id; - - delete_aud(v_audience_item_id); - - select item_id into v_background_item_id - from cr_items - where content_type = 'cr_wp_presentation_back' - and parent_id = pres_item_id; - - delete_aud(v_background_item_id); - - delete from acs_permissions where object_id = pres_item_id; - update acs_objects set context_id=null where context_id = pres_item_id; - delete from cr_wp_presentations where exists (select 1 from cr_revisions where cr_revisions.revision_id = cr_wp_presentations.presentation_id and cr_revisions.item_id = pres_item_id); - content_item.delete(pres_item_id); - end; - - function get_audience ( - pres_item_id in cr_items.item_id%TYPE - ) return blob - is - v_blob blob; - begin - select content into v_blob - from cr_revisions, cr_items - where cr_items.content_type = 'cr_wp_presentation_aud' - and cr_items.parent_id = pres_item_id - and cr_revisions.revision_id = cr_items.live_revision; - return v_blob; - end; - - function get_audience_revision ( - pres_revision_id in cr_revisions.revision_id%TYPE - ) return blob - is - v_blob blob; - begin - select r.content into v_blob - from cr_revisions r, - cr_wp_presentations_aud pa - where pa.presentation_id = pres_revision_id - and r.revision_id = pa.id; - return v_blob; - end; - - function get_background ( - pres_item_id in cr_items.item_id%TYPE - ) return blob - is - v_blob blob; - begin - select content into v_blob - from cr_revisions, cr_items - where cr_items.content_type = 'cr_wp_presentation_back' - and cr_items.parent_id = pres_item_id - and cr_revisions.revision_id = cr_items.live_revision; - return v_blob; - end; - - function get_background_revision ( - pres_revision_id in cr_revisions.revision_id%TYPE - ) return blob - is - v_blob blob; - begin - select r.content into v_blob - from cr_revisions r, - cr_wp_presentations_back pb - where pb.presentation_id = pres_revision_id - and r.revision_id = pb.id; - return v_blob; - end; - - procedure new_revision ( - 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, - pres_item_id in cr_items.item_id%TYPE, - pres_title in cr_wp_presentations.pres_title%TYPE, - page_signature in cr_wp_presentations.page_signature%TYPE, - copyright_notice in cr_wp_presentations.copyright_notice%TYPE, - style in cr_wp_presentations.style%TYPE, - public_p in cr_wp_presentations.public_p%TYPE, - show_modified_p in cr_wp_presentations.show_modified_p%TYPE, - audience in varchar2, - background in varchar2 - ) - is - v_audience_item_id cr_items.item_id%TYPE; - v_background_item_id cr_items.item_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; - v_audience_revision_id cr_revisions.revision_id%TYPE; - v_background_revision_id cr_revisions.revision_id%TYPE; - begin - - v_revision_id := content_revision.new( - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - item_id => pres_item_id, - title => '', - data => null - ); - - content_item.set_live_revision(v_revision_id); - - insert into cr_wp_presentations - ( - presentation_id, - pres_title, - page_signature, - copyright_notice, - style, - public_p, - show_modified_p - ) - values - ( - v_revision_id, - new_revision.pres_title, - new_revision.page_signature, - new_revision.copyright_notice, - new_revision.style, - new_revision.public_p, - new_revision.show_modified_p - ); - - select item_id into v_audience_item_id - from cr_items - where parent_id = pres_item_id - and content_type = 'cr_wp_presentation_aud'; - - v_audience_revision_id := content_revision.new( - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - item_id => v_audience_item_id, - title => '', - text => aud - ); - - content_item.set_live_revision(v_audience_revision_id); - - insert into cr_wp_presentations_aud - ( - id, - presentation_id - ) - values - ( - v_audience_revision_id, - v_revision_id - ); - - select item_id into v_background_item_id - from cr_items - where parent_id = pres_item_id - and content_type = 'cr_wp_presentation_back'; - - v_background_revision_id := content_revision.new( - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - item_id => v_background_item_id, - title => '', - text => back - ); - - content_item.set_live_revision(v_background_revision_id); - - insert into cr_wp_presentations_back - ( - id, - presentation_id - ) - values - ( - v_background_revision_id, - v_revision_id - ); - - end; - -end wp_presentation; -/ -show errors - - --- slide_id in clobs table added. delete_preamble, delete_postamble and delete_bullet_items added. --- get_preamble_revision, get_postamble_revision and get_bullet_items_revision added. -create or replace package wp_slide -as - function new ( - pres_item_id in cr_items.item_id%TYPE, - 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, - slide_title in cr_wp_slides.slide_title%TYPE, - style in cr_wp_slides.style%TYPE default -1, - original_slide_id in cr_wp_slides.original_slide_id%TYPE, - sort_key in cr_wp_slides.sort_key%TYPE, - preamble in varchar2, - bullet_items in varchar2, - postamble in varchar2, - include_in_outline_p in cr_wp_slides.include_in_outline_p%TYPE default 't', - context_break_after_p in cr_wp_slides.context_break_after_p%TYPE default 'f', - context_id in acs_objects.context_id%TYPE default null - ) return cr_items.item_id%TYPE; - - - procedure delete_preamble ( - preamble_item_id in cr_items.item_id%TYPE - ); - - procedure delete_postamble ( - postamble_item_id in cr_items.item_id%TYPE - ); - - procedure delete_bullet_items ( - bullet_items_item_id in cr_items.item_id%TYPE - ); - - procedure delete ( - slide_item_id in cr_items.item_id%TYPE - ); - - function get_preamble ( - slide_item_id in cr_items.item_id%TYPE - ) return blob; - - function get_preamble_revision ( - slide_revision_id in cr_revisions.revision_id%TYPE - ) return blob; - - function get_postamble ( - slide_item_id in cr_items.item_id%TYPE - ) return blob; - - function get_postamble_revision ( - slide_revision_id in cr_revisions.revision_id%TYPE - ) return blob; - - function get_bullet_items ( - slide_item_id in cr_items.item_id%TYPE - ) return blob; - - function get_bullet_items_revision ( - slide_revision_id in cr_revisions.revision_id%TYPE - ) return blob; - - procedure new_revision ( - 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, - slide_item_id in cr_items.item_id%TYPE, - slide_title in cr_wp_slides.slide_title%TYPE, - preamble in varchar2, - bullet_items in varchar2, - postamble in varchar2, - style in cr_wp_slides.style%TYPE default -1, - original_slide_id in cr_wp_slides.original_slide_id%TYPE, - sort_key in cr_wp_slides.sort_key%TYPE, - include_in_outline_p in cr_wp_slides.include_in_outline_p%TYPE default 't', - context_break_after_p in cr_wp_slides.context_break_after_p%TYPE default 'f' - ); - -end wp_slide; -/ -show errors - -create or replace package body wp_slide -as - function new ( - pres_item_id in cr_items.item_id%TYPE, - 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, - slide_title in cr_wp_slides.slide_title%TYPE, - style in cr_wp_slides.style%TYPE default -1, - original_slide_id in cr_wp_slides.original_slide_id%TYPE, - sort_key in cr_wp_slides.sort_key%TYPE, - preamble in varchar2, - bullet_items in varchar2, - postamble in varchar2, - include_in_outline_p in cr_wp_slides.include_in_outline_p%TYPE default 't', - context_break_after_p in cr_wp_slides.context_break_after_p%TYPE default 'f', - context_id in acs_objects.context_id%TYPE default null - ) return cr_items.item_id%TYPE - is - v_item_id cr_items.item_id%TYPE; - v_preamble_item_id cr_items.item_id%TYPE; - v_postamble_item_id cr_items.item_id%TYPE; - v_bullet_items_item_id cr_items.item_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; - v_preamble_revision_id cr_revisions.revision_id%TYPE; - v_postamble_revision_id cr_revisions.revision_id%TYPE; - v_bullet_items_revision_id cr_revisions.revision_id%TYPE; - v_max_id integer; - v_name cr_wp_slides.slide_title%TYPE; - begin - -- (name, parent_id) must be unique. Therefore, slide item - -- name has to be unique within a presentation. - - select nvl(max(item_id),0) into v_max_id - from cr_items - where content_type = 'cr_wp_slide' - and name like new.slide_title || '%'; - - v_name := new.slide_title || '_' || v_max_id; - - v_item_id := content_item.new( - name => v_name, - parent_id => pres_item_id, - content_type => 'cr_wp_slide', - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - v_revision_id := content_revision.new( - item_id => v_item_id, - title => '', - data => null, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - content_item.set_live_revision(v_revision_id); - - -- update sort_key - update cr_wp_slides - set sort_key = sort_key + 1 - where sort_key >= new.sort_key - and exists (select 1 from cr_items, cr_revisions where parent_id = pres_item_id and cr_items.item_id = cr_revisions.item_id and cr_revisions.revision_id=cr_wp_slides.slide_id); - - insert into cr_wp_slides - ( - slide_id, - slide_title, - style, - original_slide_id, - sort_key, - include_in_outline_p, - context_break_after_p - ) - values - ( - v_revision_id, - new.slide_title, - new.style, - new.original_slide_id, - new.sort_key, - new.include_in_outline_p, - new.context_break_after_p - ); - - - v_preamble_item_id := content_item.new( - name => 'preamble', - parent_id => v_item_id, - content_type => 'cr_wp_slide_preamble', - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - v_preamble_revision_id := content_revision.new( - item_id => v_preamble_item_id, - title => '', - text => preamble, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - content_item.set_live_revision(v_preamble_revision_id); - - insert into cr_wp_slides_preamble - ( - id, - slide_id - ) - values - ( - v_preamble_revision_id, - v_revision_id - ); - - v_postamble_item_id := content_item.new( - name => 'postamble', - parent_id => v_item_id, - content_type => 'cr_wp_slide_postamble', - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - v_postamble_revision_id := content_revision.new( - item_id => v_postamble_item_id, - title => '', - text => postamble, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - content_item.set_live_revision(v_postamble_revision_id); - - insert into cr_wp_slides_postamble - ( - id, - slide_id - ) - values - ( - v_postamble_revision_id, - v_revision_id - ); - - v_bullet_items_item_id := content_item.new( - name => 'bullet_items', - parent_id => v_item_id, - content_type => 'cr_wp_slide_bullet_items', - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - v_bullet_items_revision_id := content_revision.new( - item_id => v_bullet_items_item_id, - title => '', - text => bullet_items, - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip - ); - - content_item.set_live_revision(v_bullet_items_revision_id); - - insert into cr_wp_slides_bullet_items - ( - id, - slide_id - ) - values - ( - v_bullet_items_revision_id, - v_revision_id - ); - - return v_item_id; - end; - - procedure delete_preamble ( - preamble_item_id in cr_items.item_id%TYPE - ) - is - begin - delete from cr_wp_slides_preamble - where exists (select 1 from cr_revisions where revision_id = cr_wp_slides_preamble.id and item_id = preamble_item_id); - - delete from cr_item_publish_audit - where item_id = preamble_item_id; - - content_item.delete(preamble_item_id); - end; - - procedure delete_postamble ( - postamble_item_id in cr_items.item_id%TYPE - ) - is - begin - delete from cr_wp_slides_postamble - where exists (select 1 from cr_revisions where revision_id = cr_wp_slides_postamble.id and item_id = postamble_item_id); - - delete from cr_item_publish_audit - where item_id = postamble_item_id; - - content_item.delete(postamble_item_id); - end; - - procedure delete_bullet_items ( - bullet_items_item_id in cr_items.item_id%TYPE - ) - is - begin - delete from cr_wp_slides_bullet_items - where exists (select 1 from cr_revisions where revision_id = cr_wp_slides_bullet_items.id and item_id = bullet_items_item_id); - - delete from cr_item_publish_audit - where item_id = bullet_items_item_id; - - content_item.delete(bullet_items_item_id); - end; - - procedure delete ( - slide_item_id in cr_items.item_id%TYPE - ) - is - v_sort_key cr_wp_slides.sort_key%TYPE; - v_pres_item_id cr_items.item_id%TYPE; - v_preamble_item_id cr_items.item_id%TYPE; - v_postamble_item_id cr_items.item_id%TYPE; - v_bullet_items_item_id cr_items.item_id%TYPE; - cursor v_attach_cursor is - select item_id as attach_item_id - from cr_items - where content_type = 'cr_wp_attachment' - and parent_id = slide_item_id; - begin - for c in v_attach_cursor loop - wp_attachment.delete(c.attach_item_id); - end loop; - - select item_id into v_preamble_item_id - from cr_items - where content_type = 'cr_wp_slide_preamble' - and parent_id = slide_item_id; - - delete_preamble(v_preamble_item_id); - - select item_id into v_postamble_item_id - from cr_items - where content_type = 'cr_wp_slide_postamble' - and parent_id = slide_item_id; - - delete_postamble(v_postamble_item_id); - - select item_id into v_bullet_items_item_id - from cr_items - where content_type = 'cr_wp_slide_bullet_items' - and parent_id = slide_item_id; - - delete_bullet_items(v_bullet_items_item_id); - - -- sort_key of all revisions should be the same - select max(s.sort_key), max(i.parent_id) into v_sort_key, v_pres_item_id - from cr_wp_slides s, cr_revisions r, cr_items i - where r.item_id = slide_item_id - and r.revision_id = s.slide_id - and i.item_id = r.item_id; - delete from cr_wp_slides where exists (select 1 from cr_revisions where cr_revisions.revision_id = cr_wp_slides.slide_id and cr_revisions.item_id = slide_item_id); - update cr_wp_slides set sort_key = sort_key - 1 where sort_key > v_sort_key and exists (select 1 from cr_revisions r, cr_items i where i.parent_id = v_pres_item_id and i.item_id = r.item_id and r.revision_id = cr_wp_slides.slide_id); - update acs_objects set context_id=null where context_id = slide_item_id; - delete from cr_item_publish_audit where item_id = slide_item_id; - content_item.delete(slide_item_id); - end; - - function get_preamble ( - slide_item_id in cr_items.item_id%TYPE - ) return blob - is - v_blob blob; - begin - select content into v_blob - from cr_revisions, cr_items - where cr_items.content_type = 'cr_wp_slide_preamble' - and cr_items.parent_id = slide_item_id - and cr_revisions.revision_id = cr_items.live_revision; - return v_blob; - end; - - function get_preamble_revision ( - slide_revision_id in cr_revisions.revision_id%TYPE - ) return blob - is - v_blob blob; - begin - select content into v_blob - from cr_revisions r, cr_wp_slides_preamble sp - where sp.slide_id = slide_revision_id - and r.revision_id = sp.id; - - return v_blob; - end; - - function get_postamble ( - slide_item_id in cr_items.item_id%TYPE - ) return blob - is - v_blob blob; - begin - select content into v_blob - from cr_revisions, cr_items - where cr_items.content_type = 'cr_wp_slide_postamble' - and cr_items.parent_id = slide_item_id - and cr_revisions.revision_id = cr_items.live_revision; - return v_blob; - end; - - function get_postamble_revision ( - slide_revision_id in cr_revisions.revision_id%TYPE - ) return blob - is - v_blob blob; - begin - select content into v_blob - from cr_revisions r, cr_wp_slides_postamble sp - where sp.slide_id = slide_revision_id - and r.revision_id = sp.id; - - return v_blob; - end; - - function get_bullet_items ( - slide_item_id in cr_items.item_id%TYPE - ) return blob - is - v_blob blob; - begin - select content into v_blob - from cr_revisions, cr_items - where cr_items.content_type = 'cr_wp_slide_bullet_items' - and cr_items.parent_id = slide_item_id - and cr_revisions.revision_id = cr_items.live_revision; - return v_blob; - end; - - function get_bullet_items_revision ( - slide_revision_id in cr_revisions.revision_id%TYPE - ) return blob - is - v_blob blob; - begin - select content into v_blob - from cr_revisions r, cr_wp_slides_bullet_items sb - where sb.slide_id = slide_revision_id - and r.revision_id = sb.id; - - return v_blob; - end; - - procedure new_revision ( - 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, - slide_item_id in cr_items.item_id%TYPE, - slide_title in cr_wp_slides.slide_title%TYPE, - preamble in varchar2, - bullet_items in varchar2, - postamble in varchar2, - style in cr_wp_slides.style%TYPE default -1, - original_slide_id in cr_wp_slides.original_slide_id%TYPE, - sort_key in cr_wp_slides.sort_key%TYPE, - include_in_outline_p in cr_wp_slides.include_in_outline_p%TYPE default 't', - context_break_after_p in cr_wp_slides.context_break_after_p%TYPE default 'f' - ) - is - v_preamble_item_id cr_items.item_id%TYPE; - v_postamble_item_id cr_items.item_id%TYPE; - v_bullet_items_item_id cr_items.item_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; - v_preamble_revision_id cr_revisions.revision_id%TYPE; - v_postamble_revision_id cr_revisions.revision_id%TYPE; - v_bullet_items_revision_id cr_revisions.revision_id%TYPE; - begin - - v_revision_id := content_revision.new( - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - item_id => slide_item_id, - title => '', - data => null - ); - - content_item.set_live_revision(v_revision_id); - - insert into cr_wp_slides - ( - slide_id, - slide_title, - style, - original_slide_id, - sort_key, - include_in_outline_p, - context_break_after_p - ) - values - ( - v_revision_id, - new_revision.slide_title, - new_revision.style, - new_revision.original_slide_id, - new_revision.sort_key, - new_revision.include_in_outline_p, - new_revision.context_break_after_p - ); - - - select item_id into v_preamble_item_id - from cr_items - where parent_id = slide_item_id - and content_type = 'cr_wp_slide_preamble'; - - v_preamble_revision_id := content_revision.new( - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - item_id => v_preamble_item_id, - title => '', - text => preamble - ); - - content_item.set_live_revision(v_preamble_revision_id); - - insert into cr_wp_slides_preamble - ( - id, - slide_id - ) - values - ( - v_preamble_revision_id, - v_revision_id - ); - - select item_id into v_postamble_item_id - from cr_items - where parent_id = slide_item_id - and content_type = 'cr_wp_slide_postamble'; - - v_postamble_revision_id := content_revision.new( - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - item_id => v_postamble_item_id, - title => '', - text => postamble - ); - - content_item.set_live_revision(v_postamble_revision_id); - - insert into cr_wp_slides_postamble - ( - id, - slide_id - ) - values - ( - v_postamble_revision_id, - v_revision_id - ); - - select item_id into v_bullet_items_item_id - from cr_items - where parent_id = slide_item_id - and content_type = 'cr_wp_slide_bullet_items'; - - v_bullet_items_revision_id := content_revision.new( - creation_date => creation_date, - creation_user => creation_user, - creation_ip => creation_ip, - item_id => v_bullet_items_item_id, - title => '', - text => bullet_items - ); - - content_item.set_live_revision(v_bullet_items_revision_id); - - insert into cr_wp_slides_bullet_items - ( - id, - slide_id - ) - values - ( - v_bullet_items_revision_id, - v_revision_id - ); - end; - -end wp_slide; -/ -show errors Index: openacs-4/packages/wp-slim/sql/oracle/wp-slim-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/oracle/wp-slim-create.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/sql/oracle/wp-slim-create.sql 17 May 2003 12:49:23 -0000 1.4 +++ openacs-4/packages/wp-slim/sql/oracle/wp-slim-create.sql 28 Aug 2003 09:41:59 -0000 1.5 @@ -40,30 +40,51 @@ where not exists (select 1 from cr_mime_types where mime_type = 'application/octet-stream'); +create sequence wp_style_seq; + create table wp_styles ( style_id integer constraint wp_styles_style_id_pk primary key, name varchar2(400) constraint wp_styles_name_nn not null, - -- CSS source css varchar(4000), - -- HTML style properties. Colors are in the form '192,192,255'. - text_color varchar2(20) check(text_color like '%,%,%'), - background_color varchar2(20) check(background_color like '%,%,%'), - background_image varchar2(200), - link_color varchar2(20) check(link_color like '%,%,%'), - alink_color varchar2(20) check(alink_color like '%,%,%'), - vlink_color varchar2(20) check(vlink_color like '%,%,%') + text_color varchar(20) check(text_color like '%,%,%'), + background_color varchar(20) check(background_color like '%,%,%'), + background_image integer default 0, + link_color varchar(20) check(link_color like '%,%,%'), + alink_color varchar(20) check(alink_color like '%,%,%'), + vlink_color varchar(20) check(vlink_color like '%,%,%'), + public_p char(1) default 'f' check(public_p in ('t','f')), + owner integer + constraint wp_styles_to_users + references users (user_id) ); --- Insert the magic, "default" style. + insert into wp_styles(style_id, name, css) values(-1, 'Default (Plain)', 'BODY { back-color: white; color: black } P { line-height: 120% } UL { line-height: 140% }'); +-- this is also a new index! roc@ +create index wp_styles_by_owner on wp_styles(owner); +-- new table for supporting background images! +-- Images used for styles. + +create table wp_style_images ( +-- this one references to a cr! + wp_style_images_id integer primary key, + style_id integer references wp_styles(style_id) on delete cascade not null, + file_size integer not null, + file_name varchar(200) not null +); + +create index wp_style_images_style_id on wp_style_images(style_id); + + + create table cr_wp_presentations ( presentation_id integer constraint cr_wp_presentations_id_fk @@ -88,7 +109,10 @@ -- Show last-modified date for slides? show_modified_p char(1) default 'f' constraint cr_wp_show_p_ck - check(show_modified_p in ('t','f')) + check(show_modified_p in ('t','f')), + show_comments_p char(1) default 'f' + constraint cr_wp_pres_show_comments_p + check(show_comments_p in ('t','f')) ); @@ -533,20 +557,7 @@ show errors --- begin - -- bind privileges to global names - - -- acs_privilege.add_child('create','wp_create_presentation'); - -- acs_privilege.add_child('write','wp_edit_presentation'); - -- acs_privilege.add_child('delete','wp_delete_presentation'); - -- acs_privilege.add_child('read','wp_view_presentation'); - -- commit; --- end; --- / --- show errors - - declare default_context acs_objects.object_id%TYPE; registered_users acs_objects.object_id%TYPE; @@ -555,7 +566,7 @@ default_context := acs.magic_object_id('default_context'); registered_users := acs.magic_object_id('registered_users'); - the_public := acs.magic_object_id('the_public'); +-- the_public := acs.magic_object_id('the_public'); -- give registered users the power to create presentations by default @@ -567,11 +578,12 @@ -- give the public the power to view by default - acs_permission.grant_permission ( - object_id => default_context, - grantee_id => the_public, - privilege => 'wp_view_presentation' - ); +-- this commented out because permission, with this any user could see an slide that has not become public! +-- acs_permission.grant_permission ( +-- object_id => default_context, +-- grantee_id => the_public, +-- privilege => 'wp_view_presentation' +-- ); end; / @@ -1672,4 +1684,90 @@ show errors +-- adding some new permissions roc@ + +Begin + + acs_privilege.add_child('wp_edit_presentation', 'wp_view_presentation'); + acs_privilege.add_child('wp_admin_presentation', 'wp_create_presentation'); + acs_privilege.add_child('wp_admin_presentation', 'wp_edit_presentation'); + acs_privilege.add_child('wp_admin_presentation', 'wp_delete_presentation'); + +-- lets give site-wide permissions, wp-permissions! + acs_privilege.add_child('admin', 'wp_admin_presentation'); + +end; +/ + +--style package roc@ + +create or replace package wp_style +as + +procedure delete ( + p_style_id in wp_styles.style_id%TYPE +); + +procedure image_delete( + p_revision_id in wp_style_images.wp_style_images_id%TYPE +); + +end wp_style; +/ +show errors + + + +create or replace package body wp_style +as + +procedure delete ( + p_style_id in wp_styles.style_id%TYPE +) +is + p_item_id integer; +begin + + for one_image in ( + select * from wp_style_images + where wp_style_images_id = (select background_image from wp_styles where style_id = wp_style.delete.p_style_id)) + loop + delete from wp_style_images where wp_style_images_id = one_image.wp_style_images_id; + select item_id into p_item_id from cr_revisions where revision_id = one_image.wp_style_images_id; + + content_item.delete(item_id => p_item_id); + end loop; + + update cr_wp_slides set style = -1 where style = wp_style.delete.p_style_id; + update cr_wp_presentations set style = -1 where style = wp_style.delete.p_style_id; + delete from wp_styles where style_id = wp_style.delete.p_style_id; + +end; + + + +procedure image_delete( + p_revision_id in wp_style_images.wp_style_images_id%TYPE +) +is + p_item_id integer; +begin + + update wp_styles set background_image = 0 where background_image = wp_style.image_delete.p_revision_id; + + delete from wp_style_images + where wp_style_images_id = wp_style.image_delete.p_revision_id; + + select item_id into p_item_id from cr_revisions where revision_id = wp_style.image_delete.p_revision_id; + + content_item.delete(item_id => p_item_id); + +end; + + +end wp_style; +/ +show errors + + commit; Index: openacs-4/packages/wp-slim/sql/oracle/wp-slim-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/oracle/wp-slim-drop.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/sql/oracle/wp-slim-drop.sql 13 Mar 2002 22:50:53 -0000 1.3 +++ openacs-4/packages/wp-slim/sql/oracle/wp-slim-drop.sql 28 Aug 2003 09:41:59 -0000 1.4 @@ -195,25 +195,35 @@ default_context := acs.magic_object_id('default_context'); registered_users := acs.magic_object_id('registered_users'); - the_public := acs.magic_object_id('the_public'); +-- the_public := acs.magic_object_id('the_public'); acs_permission.revoke_permission ( object_id => default_context, grantee_id => registered_users, privilege => 'wp_create_presentation' ); - acs_permission.revoke_permission ( - object_id => default_context, - grantee_id => the_public, - privilege => 'wp_view_presentation' - ); +-- acs_permission.revoke_permission ( +-- object_id => default_context, +-- grantee_id => the_public, +-- privilege => 'wp_view_presentation' +-- ); end; / show errors begin + + + acs_privilege.remove_child('admin', 'wp_admin_presentation'); + + acs_privilege.remove_child('wp_edit_presentation', 'wp_view_presentation'); + acs_privilege.remove_child('wp_admin_presentation', 'wp_create_presentation'); + acs_privilege.remove_child('wp_admin_presentation', 'wp_edit_presentation'); + acs_privilege.remove_child('wp_admin_presentation', 'wp_delete_presentation'); + + delete from acs_permissions where privilege in ('wp_admin_presentation', 'wp_create_presentation', 'wp_edit_presentation', 'wp_delete_presentation', 'wp_view_presentation'); acs_privilege.drop_privilege('wp_admin_presentation'); @@ -253,6 +263,15 @@ drop view cr_wp_presentationsx; drop table cr_wp_presentations; +-- droping style definitions roc@ + +drop package wp_style; + + +drop sequence wp_style_seq; + +drop table wp_style_images; + drop table wp_styles; commit; Index: openacs-4/packages/wp-slim/sql/oracle/upgrade/upgrade-4.0b-4.0b1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/oracle/upgrade/upgrade-4.0b-4.0b1.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/sql/oracle/upgrade/upgrade-4.0b-4.0b1.sql 28 Aug 2003 09:41:59 -0000 1.2 @@ -0,0 +1,1178 @@ +-- add a (possibly) new mime type +insert into cr_mime_types (mime_type) +select 'application/octet-stream' +from dual +where not exists (select 1 from cr_mime_types where mime_type = 'application/octet-stream'); + + +-- users with wp_admin_presentaiton privilege can access +-- authorization pages +begin + acs_privilege.create_privilege('wp_admin_presentation'); +end; +/ +show errors + + +-- add a parent_id column in all of the auxiliary tables for clobs so that we can keep +-- track of all revisions of a specific presentation or slide. +alter table cr_wp_presentations_aud add ( + presentation_id integer + constraint cr_wp_paudience_pid_nn + not null + constraint cr_wp_paudience_pid_fk + references cr_wp_presentations +); + +alter table cr_wp_presentations_back add ( + presentation_id integer + constraint cr_wp_pbackground_pid_nn + not null + constraint cr_wp_pbackground_pid_fk + references cr_wp_presentations +); + +alter table cr_wp_slides_preamble add ( + slide_id integer + constraint cr_wp_spreamble_sid_nn + not null + constraint cr_wp_spreamble_sid_fk + references cr_wp_slides +); + +alter table cr_wp_slides_postamble add ( + slide_id integer + constraint cr_wp_spostamble_sid_nn + not null + constraint cr_wp_spostamble_sid_fk + references cr_wp_slides +); + +alter table cr_wp_slides_bullet_items add ( + slide_id integer + constraint cr_wp_sbullet_sid_nn + not null + constraint cr_wp_sbullet_sid_fk + references cr_wp_slides +); + +-- add the correspondent attributes +declare + attr_id acs_attributes.attribute_id%TYPE; +begin + + attr_id := content_type.create_attribute ( + content_type => 'cr_wp_presentation_aud', + attribute_name => 'presentation_id', + datatype => 'integer', + pretty_name => 'Prsentation ID', + pretty_plural => 'Presentation IDs', + column_spec => 'integer' + ); + + attr_id := content_type.create_attribute ( + content_type => 'cr_wp_presentation_back', + attribute_name => 'presentation_id', + datatype => 'integer', + pretty_name => 'Prsentation ID', + pretty_plural => 'Presentation IDs', + column_spec => 'integer' + ); + + attr_id := content_type.create_attribute ( + content_type => 'cr_wp_slide_preamble', + attribute_name => 'slide_id', + datatype => 'integer', + pretty_name => 'Slide ID', + pretty_plural => 'Slide IDs', + column_spec => 'integer' + ); + + attr_id := content_type.create_attribute ( + content_type => 'cr_wp_slide_postamble', + attribute_name => 'slide_id', + datatype => 'integer', + pretty_name => 'Slide ID', + pretty_plural => 'Slide IDs', + column_spec => 'integer' + ); + + attr_id := content_type.create_attribute ( + content_type => 'cr_wp_slide_bullet_items', + attribute_name => 'slide_id', + datatype => 'integer', + pretty_name => 'Slide ID', + pretty_plural => 'Slide IDs', + column_spec => 'integer' + ); +end; +/ +show errors + + + + +-- add a public_p column +alter table cr_wp_presentations +add ( + public_p char(1) default 'f' + constraint cr_wp_public_p_ck + check(public_p in ('t','f')) +); + +-- create a public_p attribute +declare + attr_id acs_attributes.attribute_id%TYPE; +begin + attr_id := content_type.create_attribute ( + content_type => 'cr_wp_presentation', + attribute_name => 'public_p', + datatype => 'boolean', + pretty_name => 'Public Flag', + pretty_plural => 'Public Flags', + column_spec => 'char(1)' + ); +end; +/ +show errors + +-- public_p added. delete_audience and delete_background added. +-- get_audience_revision and get_background_revision added. +create or replace package wp_presentation +as + function new ( + 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, + pres_title in cr_wp_presentations.pres_title%TYPE, + page_signature in cr_wp_presentations.page_signature%TYPE, + copyright_notice in cr_wp_presentations.copyright_notice%TYPE, + style in cr_wp_presentations.style%TYPE default -1, + public_p in cr_wp_presentations.public_p%TYPE default 'f', + show_modified_p in cr_wp_presentations.show_modified_p%TYPE default 'f', + audience in varchar2, + background in varchar2 + ) return cr_items.item_id%TYPE; + + procedure delete_audience ( + audience_item_id in cr_items.item_id%TYPE + ); + + procedure delete_background ( + background_item_id in cr_items.item_id%TYPE + ); + + procedure delete ( + pres_item_id in cr_items.item_id%TYPE + ); + + function get_audience ( + pres_item_id in cr_items.item_id%TYPE + ) return blob; + + function get_audience_revision ( + pres_revision_id in cr_revisions.revision_id%TYPE + ) return blob; + + function get_background ( + pres_item_id in cr_items.item_id%TYPE + ) return blob; + + function get_background_revision ( + pres_revision_id in cr_revisions.revision_id%TYPE + ) return blob; + + procedure new_revision ( + 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, + pres_item_id in cr_items.item_id%TYPE, + pres_title in cr_wp_presentations.pres_title%TYPE, + page_signature in cr_wp_presentations.page_signature%TYPE, + copyright_notice in cr_wp_presentations.copyright_notice%TYPE, + style in cr_wp_presentations.style%TYPE, + public_p in cr_wp_presentations.public_p%TYPE, + show_modified_p in cr_wp_presentations.show_modified_p%TYPE, + audience in varchar2, + background in varchar2 + ); + +end wp_presentation; +/ +show errors + + +-- public_p added. delete_audience and delete_background added. presentation_id in clobs table added. +-- get_audience_revision and get_background_revision added. +create or replace package body wp_presentation +as + function new ( + 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, + pres_title in cr_wp_presentations.pres_title%TYPE, + page_signature in cr_wp_presentations.page_signature%TYPE, + copyright_notice in cr_wp_presentations.copyright_notice%TYPE, + style in cr_wp_presentations.style%TYPE default -1, + public_p in cr_wp_presentations.public_p%TYPE, + show_modified_p in cr_wp_presentations.show_modified_p%TYPE default 'f', + audience in varchar2, + background in varchar2 + ) return cr_items.item_id%TYPE + is + v_item_id cr_items.item_id%TYPE; + v_audience_item_id cr_items.item_id%TYPE; + v_background_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_audience_revision_id cr_revisions.revision_id%TYPE; + v_background_revision_id cr_revisions.revision_id%TYPE; + v_max_id integer; + v_name cr_wp_presentations.pres_title%TYPE; + begin + -- (name, parent_id) must be unique. For type cr_wp_presentation, + -- name has to be unique because parent_id is null. + + select nvl(max(item_id),0) into v_max_id + from cr_items + where content_type = 'cr_wp_presentation' + and name like new.pres_title || '%'; + + v_name := new.pres_title || '_' || v_max_id; + + v_item_id := content_item.new( + name => v_name, + content_type => 'cr_wp_presentation', + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + v_revision_id := content_revision.new( + item_id => v_item_id, + title => '', + data => null, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + content_item.set_live_revision(v_revision_id); + + insert into cr_wp_presentations + ( + presentation_id, + pres_title, + page_signature, + copyright_notice, + style, + public_p, + show_modified_p + ) + values + ( + v_revision_id, + new.pres_title, + new.page_signature, + new.copyright_notice, + new.style, + new.public_p, + new.show_modified_p + ); + + v_audience_item_id := content_item.new( + name => 'audience', + parent_id => v_item_id, + content_type => 'cr_wp_presentation_aud', + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + v_audience_revision_id := content_revision.new( + item_id => v_audience_item_id, + title => '', + text => audience, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + content_item.set_live_revision(v_audience_revision_id); + + insert into cr_wp_presentations_aud + ( + id, + presentation_id + ) + values + ( + v_audience_revision_id, + v_revision_id + ); + + v_background_item_id := content_item.new( + name => 'background', + parent_id => v_item_id, + content_type => 'cr_wp_presentation_back', + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + v_background_revision_id := content_revision.new( + item_id => v_background_item_id, + title => '', + text => background, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + content_item.set_live_revision(v_background_revision_id); + + insert into cr_wp_presentations_back + ( + id, + presentation_id + ) + values + ( + v_background_revision_id, + v_revision_id + ); + + return v_item_id; + end; + + + procedure delete_audience ( + audience_item_id in cr_items.item_id%TYPE + ) + is + begin + delete from cr_wp_presentations_aud + where exists (select 1 from cr_revisions where revision_id = cr_wp_presentations_aud.id and item_id = audience_item_id); + + delete from cr_item_publish_audit + where item_id = audience_item_id; + + content_item.delete(audience_item_id); + end; + + procedure delete_background ( + background_item_id in cr_items.item_id%TYPE + ) + is + begin + delete from cr_wp_presentations_back + where exists (select 1 from cr_revisions where revision_id = cr_wp_presentations_back.id and item_id = background_item_id); + + delete from cr_item_publish_audit + where item_id = background_item_id; + + content_item.delete(background_item_id); + end; + + procedure delete ( + pres_item_id in cr_items.item_id%TYPE + ) + is + v_audience_item_id cr_items.item_id%TYPE; + v_background_item_id cr_items.item_id%TYPE; + cursor v_slide_cursor is + select item_id as slide_item_id + from cr_items + where content_type = 'cr_wp_slide' + and parent_id = pres_item_id; + begin + for c in v_slide_cursor loop + wp_slide.delete(c.slide_item_id); + end loop; + + select item_id into v_audience_item_id + from cr_items + where content_type = 'cr_wp_presentation_aud' + and parent_id = pres_item_id; + + delete_aud(v_audience_item_id); + + select item_id into v_background_item_id + from cr_items + where content_type = 'cr_wp_presentation_back' + and parent_id = pres_item_id; + + delete_aud(v_background_item_id); + + delete from acs_permissions where object_id = pres_item_id; + update acs_objects set context_id=null where context_id = pres_item_id; + delete from cr_wp_presentations where exists (select 1 from cr_revisions where cr_revisions.revision_id = cr_wp_presentations.presentation_id and cr_revisions.item_id = pres_item_id); + content_item.delete(pres_item_id); + end; + + function get_audience ( + pres_item_id in cr_items.item_id%TYPE + ) return blob + is + v_blob blob; + begin + select content into v_blob + from cr_revisions, cr_items + where cr_items.content_type = 'cr_wp_presentation_aud' + and cr_items.parent_id = pres_item_id + and cr_revisions.revision_id = cr_items.live_revision; + return v_blob; + end; + + function get_audience_revision ( + pres_revision_id in cr_revisions.revision_id%TYPE + ) return blob + is + v_blob blob; + begin + select r.content into v_blob + from cr_revisions r, + cr_wp_presentations_aud pa + where pa.presentation_id = pres_revision_id + and r.revision_id = pa.id; + return v_blob; + end; + + function get_background ( + pres_item_id in cr_items.item_id%TYPE + ) return blob + is + v_blob blob; + begin + select content into v_blob + from cr_revisions, cr_items + where cr_items.content_type = 'cr_wp_presentation_back' + and cr_items.parent_id = pres_item_id + and cr_revisions.revision_id = cr_items.live_revision; + return v_blob; + end; + + function get_background_revision ( + pres_revision_id in cr_revisions.revision_id%TYPE + ) return blob + is + v_blob blob; + begin + select r.content into v_blob + from cr_revisions r, + cr_wp_presentations_back pb + where pb.presentation_id = pres_revision_id + and r.revision_id = pb.id; + return v_blob; + end; + + procedure new_revision ( + 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, + pres_item_id in cr_items.item_id%TYPE, + pres_title in cr_wp_presentations.pres_title%TYPE, + page_signature in cr_wp_presentations.page_signature%TYPE, + copyright_notice in cr_wp_presentations.copyright_notice%TYPE, + style in cr_wp_presentations.style%TYPE, + public_p in cr_wp_presentations.public_p%TYPE, + show_modified_p in cr_wp_presentations.show_modified_p%TYPE, + audience in varchar2, + background in varchar2 + ) + is + v_audience_item_id cr_items.item_id%TYPE; + v_background_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_audience_revision_id cr_revisions.revision_id%TYPE; + v_background_revision_id cr_revisions.revision_id%TYPE; + begin + + v_revision_id := content_revision.new( + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + item_id => pres_item_id, + title => '', + data => null + ); + + content_item.set_live_revision(v_revision_id); + + insert into cr_wp_presentations + ( + presentation_id, + pres_title, + page_signature, + copyright_notice, + style, + public_p, + show_modified_p + ) + values + ( + v_revision_id, + new_revision.pres_title, + new_revision.page_signature, + new_revision.copyright_notice, + new_revision.style, + new_revision.public_p, + new_revision.show_modified_p + ); + + select item_id into v_audience_item_id + from cr_items + where parent_id = pres_item_id + and content_type = 'cr_wp_presentation_aud'; + + v_audience_revision_id := content_revision.new( + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + item_id => v_audience_item_id, + title => '', + text => aud + ); + + content_item.set_live_revision(v_audience_revision_id); + + insert into cr_wp_presentations_aud + ( + id, + presentation_id + ) + values + ( + v_audience_revision_id, + v_revision_id + ); + + select item_id into v_background_item_id + from cr_items + where parent_id = pres_item_id + and content_type = 'cr_wp_presentation_back'; + + v_background_revision_id := content_revision.new( + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + item_id => v_background_item_id, + title => '', + text => back + ); + + content_item.set_live_revision(v_background_revision_id); + + insert into cr_wp_presentations_back + ( + id, + presentation_id + ) + values + ( + v_background_revision_id, + v_revision_id + ); + + end; + +end wp_presentation; +/ +show errors + + +-- slide_id in clobs table added. delete_preamble, delete_postamble and delete_bullet_items added. +-- get_preamble_revision, get_postamble_revision and get_bullet_items_revision added. +create or replace package wp_slide +as + function new ( + pres_item_id in cr_items.item_id%TYPE, + 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, + slide_title in cr_wp_slides.slide_title%TYPE, + style in cr_wp_slides.style%TYPE default -1, + original_slide_id in cr_wp_slides.original_slide_id%TYPE, + sort_key in cr_wp_slides.sort_key%TYPE, + preamble in varchar2, + bullet_items in varchar2, + postamble in varchar2, + include_in_outline_p in cr_wp_slides.include_in_outline_p%TYPE default 't', + context_break_after_p in cr_wp_slides.context_break_after_p%TYPE default 'f', + context_id in acs_objects.context_id%TYPE default null + ) return cr_items.item_id%TYPE; + + + procedure delete_preamble ( + preamble_item_id in cr_items.item_id%TYPE + ); + + procedure delete_postamble ( + postamble_item_id in cr_items.item_id%TYPE + ); + + procedure delete_bullet_items ( + bullet_items_item_id in cr_items.item_id%TYPE + ); + + procedure delete ( + slide_item_id in cr_items.item_id%TYPE + ); + + function get_preamble ( + slide_item_id in cr_items.item_id%TYPE + ) return blob; + + function get_preamble_revision ( + slide_revision_id in cr_revisions.revision_id%TYPE + ) return blob; + + function get_postamble ( + slide_item_id in cr_items.item_id%TYPE + ) return blob; + + function get_postamble_revision ( + slide_revision_id in cr_revisions.revision_id%TYPE + ) return blob; + + function get_bullet_items ( + slide_item_id in cr_items.item_id%TYPE + ) return blob; + + function get_bullet_items_revision ( + slide_revision_id in cr_revisions.revision_id%TYPE + ) return blob; + + procedure new_revision ( + 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, + slide_item_id in cr_items.item_id%TYPE, + slide_title in cr_wp_slides.slide_title%TYPE, + preamble in varchar2, + bullet_items in varchar2, + postamble in varchar2, + style in cr_wp_slides.style%TYPE default -1, + original_slide_id in cr_wp_slides.original_slide_id%TYPE, + sort_key in cr_wp_slides.sort_key%TYPE, + include_in_outline_p in cr_wp_slides.include_in_outline_p%TYPE default 't', + context_break_after_p in cr_wp_slides.context_break_after_p%TYPE default 'f' + ); + +end wp_slide; +/ +show errors + +create or replace package body wp_slide +as + function new ( + pres_item_id in cr_items.item_id%TYPE, + 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, + slide_title in cr_wp_slides.slide_title%TYPE, + style in cr_wp_slides.style%TYPE default -1, + original_slide_id in cr_wp_slides.original_slide_id%TYPE, + sort_key in cr_wp_slides.sort_key%TYPE, + preamble in varchar2, + bullet_items in varchar2, + postamble in varchar2, + include_in_outline_p in cr_wp_slides.include_in_outline_p%TYPE default 't', + context_break_after_p in cr_wp_slides.context_break_after_p%TYPE default 'f', + context_id in acs_objects.context_id%TYPE default null + ) return cr_items.item_id%TYPE + is + v_item_id cr_items.item_id%TYPE; + v_preamble_item_id cr_items.item_id%TYPE; + v_postamble_item_id cr_items.item_id%TYPE; + v_bullet_items_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_preamble_revision_id cr_revisions.revision_id%TYPE; + v_postamble_revision_id cr_revisions.revision_id%TYPE; + v_bullet_items_revision_id cr_revisions.revision_id%TYPE; + v_max_id integer; + v_name cr_wp_slides.slide_title%TYPE; + begin + -- (name, parent_id) must be unique. Therefore, slide item + -- name has to be unique within a presentation. + + select nvl(max(item_id),0) into v_max_id + from cr_items + where content_type = 'cr_wp_slide' + and name like new.slide_title || '%'; + + v_name := new.slide_title || '_' || v_max_id; + + v_item_id := content_item.new( + name => v_name, + parent_id => pres_item_id, + content_type => 'cr_wp_slide', + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + v_revision_id := content_revision.new( + item_id => v_item_id, + title => '', + data => null, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + content_item.set_live_revision(v_revision_id); + + -- update sort_key + update cr_wp_slides + set sort_key = sort_key + 1 + where sort_key >= new.sort_key + and exists (select 1 from cr_items, cr_revisions where parent_id = pres_item_id and cr_items.item_id = cr_revisions.item_id and cr_revisions.revision_id=cr_wp_slides.slide_id); + + insert into cr_wp_slides + ( + slide_id, + slide_title, + style, + original_slide_id, + sort_key, + include_in_outline_p, + context_break_after_p + ) + values + ( + v_revision_id, + new.slide_title, + new.style, + new.original_slide_id, + new.sort_key, + new.include_in_outline_p, + new.context_break_after_p + ); + + + v_preamble_item_id := content_item.new( + name => 'preamble', + parent_id => v_item_id, + content_type => 'cr_wp_slide_preamble', + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + v_preamble_revision_id := content_revision.new( + item_id => v_preamble_item_id, + title => '', + text => preamble, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + content_item.set_live_revision(v_preamble_revision_id); + + insert into cr_wp_slides_preamble + ( + id, + slide_id + ) + values + ( + v_preamble_revision_id, + v_revision_id + ); + + v_postamble_item_id := content_item.new( + name => 'postamble', + parent_id => v_item_id, + content_type => 'cr_wp_slide_postamble', + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + v_postamble_revision_id := content_revision.new( + item_id => v_postamble_item_id, + title => '', + text => postamble, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + content_item.set_live_revision(v_postamble_revision_id); + + insert into cr_wp_slides_postamble + ( + id, + slide_id + ) + values + ( + v_postamble_revision_id, + v_revision_id + ); + + v_bullet_items_item_id := content_item.new( + name => 'bullet_items', + parent_id => v_item_id, + content_type => 'cr_wp_slide_bullet_items', + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + v_bullet_items_revision_id := content_revision.new( + item_id => v_bullet_items_item_id, + title => '', + text => bullet_items, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + + content_item.set_live_revision(v_bullet_items_revision_id); + + insert into cr_wp_slides_bullet_items + ( + id, + slide_id + ) + values + ( + v_bullet_items_revision_id, + v_revision_id + ); + + return v_item_id; + end; + + procedure delete_preamble ( + preamble_item_id in cr_items.item_id%TYPE + ) + is + begin + delete from cr_wp_slides_preamble + where exists (select 1 from cr_revisions where revision_id = cr_wp_slides_preamble.id and item_id = preamble_item_id); + + delete from cr_item_publish_audit + where item_id = preamble_item_id; + + content_item.delete(preamble_item_id); + end; + + procedure delete_postamble ( + postamble_item_id in cr_items.item_id%TYPE + ) + is + begin + delete from cr_wp_slides_postamble + where exists (select 1 from cr_revisions where revision_id = cr_wp_slides_postamble.id and item_id = postamble_item_id); + + delete from cr_item_publish_audit + where item_id = postamble_item_id; + + content_item.delete(postamble_item_id); + end; + + procedure delete_bullet_items ( + bullet_items_item_id in cr_items.item_id%TYPE + ) + is + begin + delete from cr_wp_slides_bullet_items + where exists (select 1 from cr_revisions where revision_id = cr_wp_slides_bullet_items.id and item_id = bullet_items_item_id); + + delete from cr_item_publish_audit + where item_id = bullet_items_item_id; + + content_item.delete(bullet_items_item_id); + end; + + procedure delete ( + slide_item_id in cr_items.item_id%TYPE + ) + is + v_sort_key cr_wp_slides.sort_key%TYPE; + v_pres_item_id cr_items.item_id%TYPE; + v_preamble_item_id cr_items.item_id%TYPE; + v_postamble_item_id cr_items.item_id%TYPE; + v_bullet_items_item_id cr_items.item_id%TYPE; + cursor v_attach_cursor is + select item_id as attach_item_id + from cr_items + where content_type = 'cr_wp_attachment' + and parent_id = slide_item_id; + begin + for c in v_attach_cursor loop + wp_attachment.delete(c.attach_item_id); + end loop; + + select item_id into v_preamble_item_id + from cr_items + where content_type = 'cr_wp_slide_preamble' + and parent_id = slide_item_id; + + delete_preamble(v_preamble_item_id); + + select item_id into v_postamble_item_id + from cr_items + where content_type = 'cr_wp_slide_postamble' + and parent_id = slide_item_id; + + delete_postamble(v_postamble_item_id); + + select item_id into v_bullet_items_item_id + from cr_items + where content_type = 'cr_wp_slide_bullet_items' + and parent_id = slide_item_id; + + delete_bullet_items(v_bullet_items_item_id); + + -- sort_key of all revisions should be the same + select max(s.sort_key), max(i.parent_id) into v_sort_key, v_pres_item_id + from cr_wp_slides s, cr_revisions r, cr_items i + where r.item_id = slide_item_id + and r.revision_id = s.slide_id + and i.item_id = r.item_id; + delete from cr_wp_slides where exists (select 1 from cr_revisions where cr_revisions.revision_id = cr_wp_slides.slide_id and cr_revisions.item_id = slide_item_id); + update cr_wp_slides set sort_key = sort_key - 1 where sort_key > v_sort_key and exists (select 1 from cr_revisions r, cr_items i where i.parent_id = v_pres_item_id and i.item_id = r.item_id and r.revision_id = cr_wp_slides.slide_id); + update acs_objects set context_id=null where context_id = slide_item_id; + delete from cr_item_publish_audit where item_id = slide_item_id; + content_item.delete(slide_item_id); + end; + + function get_preamble ( + slide_item_id in cr_items.item_id%TYPE + ) return blob + is + v_blob blob; + begin + select content into v_blob + from cr_revisions, cr_items + where cr_items.content_type = 'cr_wp_slide_preamble' + and cr_items.parent_id = slide_item_id + and cr_revisions.revision_id = cr_items.live_revision; + return v_blob; + end; + + function get_preamble_revision ( + slide_revision_id in cr_revisions.revision_id%TYPE + ) return blob + is + v_blob blob; + begin + select content into v_blob + from cr_revisions r, cr_wp_slides_preamble sp + where sp.slide_id = slide_revision_id + and r.revision_id = sp.id; + + return v_blob; + end; + + function get_postamble ( + slide_item_id in cr_items.item_id%TYPE + ) return blob + is + v_blob blob; + begin + select content into v_blob + from cr_revisions, cr_items + where cr_items.content_type = 'cr_wp_slide_postamble' + and cr_items.parent_id = slide_item_id + and cr_revisions.revision_id = cr_items.live_revision; + return v_blob; + end; + + function get_postamble_revision ( + slide_revision_id in cr_revisions.revision_id%TYPE + ) return blob + is + v_blob blob; + begin + select content into v_blob + from cr_revisions r, cr_wp_slides_postamble sp + where sp.slide_id = slide_revision_id + and r.revision_id = sp.id; + + return v_blob; + end; + + function get_bullet_items ( + slide_item_id in cr_items.item_id%TYPE + ) return blob + is + v_blob blob; + begin + select content into v_blob + from cr_revisions, cr_items + where cr_items.content_type = 'cr_wp_slide_bullet_items' + and cr_items.parent_id = slide_item_id + and cr_revisions.revision_id = cr_items.live_revision; + return v_blob; + end; + + function get_bullet_items_revision ( + slide_revision_id in cr_revisions.revision_id%TYPE + ) return blob + is + v_blob blob; + begin + select content into v_blob + from cr_revisions r, cr_wp_slides_bullet_items sb + where sb.slide_id = slide_revision_id + and r.revision_id = sb.id; + + return v_blob; + end; + + procedure new_revision ( + 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, + slide_item_id in cr_items.item_id%TYPE, + slide_title in cr_wp_slides.slide_title%TYPE, + preamble in varchar2, + bullet_items in varchar2, + postamble in varchar2, + style in cr_wp_slides.style%TYPE default -1, + original_slide_id in cr_wp_slides.original_slide_id%TYPE, + sort_key in cr_wp_slides.sort_key%TYPE, + include_in_outline_p in cr_wp_slides.include_in_outline_p%TYPE default 't', + context_break_after_p in cr_wp_slides.context_break_after_p%TYPE default 'f' + ) + is + v_preamble_item_id cr_items.item_id%TYPE; + v_postamble_item_id cr_items.item_id%TYPE; + v_bullet_items_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_preamble_revision_id cr_revisions.revision_id%TYPE; + v_postamble_revision_id cr_revisions.revision_id%TYPE; + v_bullet_items_revision_id cr_revisions.revision_id%TYPE; + begin + + v_revision_id := content_revision.new( + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + item_id => slide_item_id, + title => '', + data => null + ); + + content_item.set_live_revision(v_revision_id); + + insert into cr_wp_slides + ( + slide_id, + slide_title, + style, + original_slide_id, + sort_key, + include_in_outline_p, + context_break_after_p + ) + values + ( + v_revision_id, + new_revision.slide_title, + new_revision.style, + new_revision.original_slide_id, + new_revision.sort_key, + new_revision.include_in_outline_p, + new_revision.context_break_after_p + ); + + + select item_id into v_preamble_item_id + from cr_items + where parent_id = slide_item_id + and content_type = 'cr_wp_slide_preamble'; + + v_preamble_revision_id := content_revision.new( + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + item_id => v_preamble_item_id, + title => '', + text => preamble + ); + + content_item.set_live_revision(v_preamble_revision_id); + + insert into cr_wp_slides_preamble + ( + id, + slide_id + ) + values + ( + v_preamble_revision_id, + v_revision_id + ); + + select item_id into v_postamble_item_id + from cr_items + where parent_id = slide_item_id + and content_type = 'cr_wp_slide_postamble'; + + v_postamble_revision_id := content_revision.new( + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + item_id => v_postamble_item_id, + title => '', + text => postamble + ); + + content_item.set_live_revision(v_postamble_revision_id); + + insert into cr_wp_slides_postamble + ( + id, + slide_id + ) + values + ( + v_postamble_revision_id, + v_revision_id + ); + + select item_id into v_bullet_items_item_id + from cr_items + where parent_id = slide_item_id + and content_type = 'cr_wp_slide_bullet_items'; + + v_bullet_items_revision_id := content_revision.new( + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + item_id => v_bullet_items_item_id, + title => '', + text => bullet_items + ); + + content_item.set_live_revision(v_bullet_items_revision_id); + + insert into cr_wp_slides_bullet_items + ( + id, + slide_id + ) + values + ( + v_bullet_items_revision_id, + v_revision_id + ); + end; + +end wp_slide; +/ +show errors Index: openacs-4/packages/wp-slim/sql/oracle/upgrade/upgrade-4.0b1-4.6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/oracle/upgrade/upgrade-4.0b1-4.6.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/sql/oracle/upgrade/upgrade-4.0b1-4.6.sql 28 Aug 2003 09:41:59 -0000 1.2 @@ -0,0 +1,124 @@ +-- upgrade script +-- some extra permissions roc@ +declare + default_context acs_objects.object_id%TYPE; + the_public acs_objects.object_id%TYPE; +Begin + + default_context := acs.magic_object_id('default_context'); + the_public := acs.magic_object_id('the_public'); + + + acs_permission.revoke_permission ( + object_id => default_context, + grantee_id => the_public, + privilege => 'wp_view_presentation' + ); + + + acs_privilege.add_child('wp_edit_presentation', 'wp_view_presentation'); + acs_privilege.add_child('wp_admin_presentation', 'wp_create_presentation'); + acs_privilege.add_child('wp_admin_presentation', 'wp_edit_presentation'); + acs_privilege.add_child('wp_admin_presentation', 'wp_delete_presentation'); + +-- lets give site-wide permissions, wp-permissions! + acs_privilege.add_child('admin', 'wp_admin_presentation'); +end; +/ +show errors + + + +alter table wp_styles add public_p char(1) default 'f' check(public_p in ('t','f')); +alter table wp_styles add owner integer constraint wp_styles_to_users references users (user_id); + +create sequence wp_style_seq; + +-- this is also a new index! roc@ +create index wp_styles_by_owner on wp_styles(owner); + +-- new table for supporting background images! +-- Images used for styles. + +create table wp_style_images ( +-- this one references to a cr! + wp_style_images_id integer primary key, + style_id integer references wp_styles(style_id) on delete cascade not null, + file_size integer not null, + file_name varchar(200) not null +); + +create index wp_style_images_style_id on wp_style_images(style_id); + +create or replace package wp_style +as + +procedure delete ( + p_style_id in wp_styles.style_id%TYPE +); + +procedure image_delete( + p_revision_id in wp_style_images.wp_style_images_id%TYPE +); + +end wp_style; +/ +show errors + + + +create or replace package body wp_style +as + +procedure delete ( + p_style_id in wp_styles.style_id%TYPE +) +is + p_item_id integer; +begin + + for one_image in ( + select * from wp_style_images + where wp_style_images_id = (select background_image from wp_styles where style_id = wp_style.delete.p_style_id)) + loop + delete from wp_style_images where wp_style_images_id = one_image.wp_style_images_id; + select item_id into p_item_id from cr_revisions where revision_id = one_image.wp_style_images_id; + + content_item.delete(item_id => p_item_id); + end loop; + + update cr_wp_slides set style = -1 where style = wp_style.delete.p_style_id; + update cr_wp_presentations set style = -1 where style = wp_style.delete.p_style_id; + delete from wp_styles where style_id = wp_style.delete.p_style_id; + +end; + + + +procedure image_delete( + p_revision_id in wp_style_images.wp_style_images_id%TYPE +) +is + p_item_id integer; +begin + + update wp_styles set background_image = 0 where background_image = wp_style.image_delete.p_revision_id; + + delete from wp_style_images + where wp_style_images_id = wp_style.image_delete.p_revision_id; + + select item_id into p_item_id from cr_revisions where revision_id = wp_style.image_delete.p_revision_id; + + content_item.delete(item_id => p_item_id); + +end; + + +end wp_style; +/ +show errors + + +alter table cr_wp_presentations add ( + show_comments_p char(1) default 'f' constraint cr_wp_pres_show_comments_p check(show_comments_p in ('t','f')) +); Index: openacs-4/packages/wp-slim/sql/postgresql/wp-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/postgresql/wp-packages-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/sql/postgresql/wp-packages-create.sql 28 Aug 2003 09:41:59 -0000 1.2 @@ -0,0 +1,1126 @@ +-- /packages/wp-slim/sql/postgresql/wp-packages-create.sql +-- +-- PL/pgsql for wimpy point +-- +-- @cvs-id $Id: wp-packages-create.sql,v 1.2 2003/08/28 09:41:59 lars Exp $ +-- + +--jackp: From here on the functions are defined + +--jackp: To p_create each presentation +create or replace function wp_presentation__new ( + timestamptz, + integer, + varchar, + varchar, + varchar, + varchar, + integer, + boolean, + boolean, + varchar, + varchar, + integer +) +returns integer as' +declare + p_creation_date alias for $1; + p_creation_user alias for $2; + p_creation_ip alias for $3; + p_pres_title alias for $4; + p_page_signature alias for $5; + p_copyright_notice alias for $6; + p_style alias for $7; + p_public_p alias for $8; + p_show_modified_p alias for $9; + p_aud alias for $10; + p_back alias for $11; + p_parent_id alias for $12; + v_item_id cr_items.item_id%TYPE; + v_audience_item_id cr_items.item_id%TYPE; + v_background_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_audience_revision_id cr_revisions.revision_id%TYPE; + v_background_revision_id cr_revisions.revision_id%TYPE; + v_max_id integer; + v_name cr_wp_presentations.pres_title%TYPE; +begin + select coalesce(max(item_id),0) into v_max_id + from cr_items + where content_type = ''cr_wp_presentation'' + and name like p_pres_title || ''%''; + + v_name := p_pres_title || ''_'' || v_max_id; + + v_item_id := content_item__new( + v_name, + p_parent_id, + null, + null, + p_creation_date, + p_creation_user, + null, + p_creation_ip, + ''content_item'', + ''cr_wp_presentation'', + null, + null, + ''text/plain'', + null, + null, + ''text'' + ); + + v_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + null, + v_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_revision_id); + + --jackp: Actually place the information entered + -- by the user into the table + + insert into cr_wp_presentations ( + presentation_id, + pres_title, + page_signature, + copyright_notice, + style, + public_p, + show_modified_p + ) values ( + v_revision_id, + p_pres_title, + p_page_signature, + p_copyright_notice, + p_style, + p_public_p, + p_show_modified_p + ); + + v_audience_item_id := content_item__new( + p_aud, + v_item_id, + null, + null, + p_creation_date, + p_creation_user, + null, + p_creation_ip, + ''content_item'', + ''cr_wp_presentation_aud'', + null, + null, + ''text/plain'', + null, + null, + ''text'' + ); + + v_audience_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_aud, + v_audience_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_audience_revision_id); + + insert into cr_wp_presentations_aud + (id, presentation_id) + values + (v_audience_revision_id, v_revision_id); + + v_background_item_id := content_item__new( + p_back, + v_item_id, + null, + null, + p_creation_date, + p_creation_user, + null, + p_creation_ip, + ''content_item'', + ''cr_wp_presentation_back'', + null, + null, + ''text/plain'', + null, + null, + ''text'' + ); + + v_background_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_back, + v_background_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_background_revision_id); + + insert into cr_wp_presentations_back + (id, presentation_id) + values + (v_background_revision_id, v_revision_id); + + return v_item_id; +end;' language 'plpgsql'; + +create or replace function wp_presentation__delete_audience (integer) +returns integer as ' +declare + audience_item_id alias for $1; +begin + delete from cr_wp_presentations_aud + where exists (select 1 from cr_revisions + where revision_id = cr_wp_presentations_aud.id + and item_id = audience_item_id); + + delete from cr_item_publish_audit where item_id = audience_item_id; + + perform content_item__delete(audience_item_id); + + return 0; +end;' language 'plpgsql'; + +create or replace function wp_presentation__delete_background (integer) +returns integer as ' +declare + background_item_id alias for $1; +begin + delete from cr_wp_presentations_back + where exists (select 1 from cr_revisions + where revision_id = cr_wp_presentations_back.id + and item_id = background_item_id); + + delete from cr_item_publish_audit where item_id = background_item_id; + + perform content_item__delete(background_item_id); + + return 0; +end;' language 'plpgsql'; + +create or replace function wp_presentation__delete (integer) +returns integer as ' +declare + p_pres_item_id alias for $1; + v_audience_item_id cr_items.item_id%TYPE; + v_background_item_id cr_items.item_id%TYPE; + del_rec record; +begin + for del_rec in + select item_id as slide_item_id + from cr_items + where content_type = ''cr_wp_slide'' + and parent_id = p_pres_item_id + loop + perform wp_slide__delete(del_rec.slide_item_id); + end loop; + + select item_id into v_audience_item_id + from cr_items + where content_type = ''cr_wp_presentation_aud'' + and parent_id = p_pres_item_id; + + perform wp_presentation__delete_audience(v_audience_item_id); + + select item_id into v_background_item_id + from cr_items + where content_type = ''cr_wp_presentation_back'' + and parent_id = p_pres_item_id; + + perform wp_presentation__delete_background(v_background_item_id); + + delete from acs_permissions where object_id = p_pres_item_id; + + -- update acs_objects set context_id=null where context_id = p_pres_item_id; + + delete from cr_wp_presentations where exists + (select 1 from cr_revisions + where cr_revisions.revision_id = cr_wp_presentations.presentation_id + and cr_revisions.item_id = p_pres_item_id); + + perform content_item__delete(p_pres_item_id); + + return 0; +end;' language 'plpgsql'; + +-- DRB: All these could've been implemented as a single function with a +-- type argument but I'm not going to rewrite all of wp-slim's queries +-- just to clean this up... + +create or replace function wp_presentation__get_ad_revision (integer) +returns text as ' +declare + p_pres_revision_id alias for $1; +begin + return r.content + from cr_revisions r, cr_wp_presentations_aud pa + where pa.presentation_id = p_pres_revision_id + and r.revision_id = pa.id; +end;' language 'plpgsql'; + +create or replace function wp_presentation__get_audience (integer) +returns text as ' +declare + p_pres_item_id alias for $1; +begin + return content + from cr_revisions, cr_items + where cr_items.content_type = ''cr_wp_presentation_aud'' + and cr_items.parent_id = p_pres_item_id + and cr_revisions.revision_id = cr_items__live_revision; +end;' language 'plpgsql'; + +create or replace function wp_presentation__get_bg_revision (integer) +returns text as ' +declare + p_pres_revision_id alias for $1; +begin + return r.content + from cr_revisions r, cr_wp_presentations_aud pa + where pa.presentation_id = p_pres_revision_id + and r.revision_id = pa.id; +end;' language 'plpgsql'; + +create or replace function wp_presentation__get_background (integer) +returns text as ' +declare + pres_item_id alias for $1; +begin + return content + from cr_revisions, cr_items + where cr_items.content_type = ''cr_wp_presentation_bak'' + and cr_items.parent_id = p_pres_item_id + and cr_revisions.revision_id = cr_items__live_revision; +end;' language 'plpgsql'; + +create or replace function wp_presentation__new_revision ( + timestamptz, + integer, + varchar, + integer, + varchar, + varchar, + varchar, + integer, + boolean, + boolean, + varchar, + varchar +) returns integer as ' +declare + p_creation_date alias for $1; + p_creation_user alias for $2; + p_creation_ip alias for $3; + p_pres_item_id alias for $4; + p_pres_title alias for $5; + p_page_signature alias for $6; + p_copyright_notice alias for $7; + p_style alias for $8; + p_public_p alias for $9; + p_show_modified_p alias for $10; + p_audience alias for $11; + p_background alias for $12; + v_audience_item_id cr_items.item_id%TYPE; + v_background_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_audience_revision_id cr_revisions.revision_id%TYPE; + v_background_revision_id cr_revisions.revision_id%TYPE; +begin + v_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + null, + p_pres_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_revision_id); + + insert into cr_wp_presentations ( + presentation_id, + pres_title, + page_signature, + copyright_notice, + style, + public_p, + show_modified_p + ) values ( + v_revision_id, + p_pres_title, + p_page_signature, + p_copyright_notice, + p_style, + p_public_p, + p_show_modified_p + ); + + select item_id into v_audience_item_id + from cr_items + where parent_id = p_pres_item_id + and content_type = ''cr_wp_presentation_aud''; + + v_audience_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_audience, + v_audience_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_audience_revision_id); + + insert into cr_wp_presentations_aud + (id, presentation_id) + values + (v_audience_revision_id, v_revision_id); + + select item_id into v_background_item_id + from cr_items + where parent_id = p_pres_item_id + and content_type = ''cr_wp_presentation_back''; + + v_background_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_background, + v_background_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_background_revision_id); + + insert into cr_wp_presentations_back + (id, presentation_id) + values + (v_background_revision_id, v_revision_id); + + return 0; +end;' language 'plpgsql'; + +create or replace function wp_slide__new ( + integer, + timestamptz, + integer, + varchar, + varchar, + integer, + integer, + integer, + varchar, + varchar, + varchar, + boolean, + boolean, + integer +) returns integer as ' +declare + p_pres_item_id alias for $1; + p_creation_date alias for $2; + p_creation_user alias for $3; + p_creation_ip alias for $4; + p_slide_title alias for $5; + p_style alias for $6; + p_original_slide_id alias for $7; + p_sort_key alias for $8; + p_preamble alias for $9; + p_bullet_items alias for $10; + p_postamble alias for $11; + p_include_in_outline_p alias for $12; + p_context_break_after_p alias for $13; + p_context_id alias for $14; + v_item_id cr_items.item_id%TYPE; + v_preamble_item_id cr_items.item_id%TYPE; + v_postamble_item_id cr_items.item_id%TYPE; + v_bullet_items_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_preamble_revision_id cr_revisions.revision_id%TYPE; + v_postamble_revision_id cr_revisions.revision_id%TYPE; + v_bullet_items_revision_id cr_revisions.revision_id%TYPE; + v_max_id integer; + v_name varchar; +begin + select coalesce(max(item_id),0) into v_max_id + from cr_items + where content_type = ''cr_wp_slide'' + and name like p_slide_title || ''%''; + + v_name := p_slide_title || ''_'' || v_max_id; + + v_item_id := content_item__new( + v_name, + p_pres_item_id, + null, + null, + p_creation_date, + p_creation_user, + null, + p_creation_ip, + ''content_item'', + ''cr_wp_slide'', + null, + null, + ''text/plain'', + null, + null, + ''text'' + ); + + v_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + null, + v_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_revision_id); + + update cr_wp_slides + set sort_key = sort_key + 1 + where sort_key >= p_sort_key + and exists (select 1 from cr_items, cr_revisions + where parent_id = p_pres_item_id + and cr_items.item_id = cr_revisions.item_id + and cr_revisions.revision_id=cr_wp_slides.slide_id); + + insert into cr_wp_slides ( + slide_id, + original_slide_id, + sort_key, + slide_title, + include_in_outline_p, + context_break_after_p, + style + ) values ( + v_revision_id, + p_original_slide_id, + p_sort_key, + p_slide_title, + p_include_in_outline_p, + p_context_break_after_p, + p_style + ); + + v_preamble_item_id := content_item__new( + ''preamble'', + v_item_id, + null, + null, + p_creation_date, + p_creation_user, + null, + p_creation_ip, + ''content_item'', + ''cr_wp_slide_preamble'', + null, + null, + ''text/plain'', + null, + null, + ''text'' + ); + + v_preamble_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_preamble, + v_preamble_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_preamble_revision_id); + + insert into cr_wp_slides_preamble + (id, slide_id) + values + (v_preamble_revision_id, v_revision_id); + + v_postamble_item_id := content_item__new( + ''postamble'', + v_item_id, + null, + null, + p_creation_date, + p_creation_user, + null, + p_creation_ip, + ''content_item'', + ''cr_wp_slide_postamble'', + null, + null, + ''text/plain'', + null, + null, + ''text'' + ); + + v_postamble_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_postamble, + v_postamble_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_postamble_revision_id); + + insert into cr_wp_slides_postamble + (id, slide_id) + values + (v_postamble_revision_id, v_revision_id); + + v_bullet_items_item_id := content_item__new( + ''bullet_items'', + v_item_id, + null, + null, + p_creation_date, + p_creation_user, + null, + p_creation_ip, + ''content_item'', + ''cr_wp_slide_bullet_items'', + null, + null, + null, + ''text/plain'', + null, + ''text'' + ); + + v_bullet_items_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_bullet_items, + v_bullet_items_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_bullet_items_revision_id); + + insert into cr_wp_slides_bullet_items + (id, slide_id) + values + (v_bullet_items_revision_id, v_revision_id); + + return v_item_id; +end;' language 'plpgsql'; + +create or replace function wp_slide__delete_preamble (integer) +returns integer as ' +declare + delete_preamble__preamble_item_id alias for $1; +begin + delete from cr_wp_slides_preamble + where exists (select 1 from cr_revisions + where revision_id = cr_wp_slides_preamble.id + and item_id = delete_preamble__preamble_item_id); + + delete from cr_item_publish_audit + where item_id = delete_preamble__preamble_item_id; + + perform content_item__delete(delete_preamble__preamble_item_id); + + return 0; +end;' language 'plpgsql'; + +create or replace function wp_slide__delete_postamble(integer) +returns integer as ' +declare + delete_postamble__postamble_item_id alias for $1; +begin + delete from cr_wp_slides_postamble + where exists (select 1 from cr_revisions + where revision_id = cr_wp_slides_postamble.id + and item_id = delete_postamble__postamble_item_id); + + delete from cr_item_publish_audit + where item_id = delete_postamble__postamble_item_id; + + perform content_item__delete(delete_postamble__postamble_item_id); + + return 0; +end;' language 'plpgsql'; + +create or replace function wp_slide__delete_bullet_items(integer) +returns integer as ' +declare + delete_bullet_items__bullet_items_item_id alias for $1; +begin + delete from cr_wp_slides_bullet_items + where exists (select 1 from cr_revisions + where revision_id = cr_wp_slides_bullet_items.id + and item_id = delete_bullet_items__bullet_items_item_id); + + delete from cr_item_publish_audit + where item_id = delete_bullet_items__bullet_items_item_id; + + perform content_item__delete(delete_bullet_items__bullet_items_item_id); + + return 0; +end;' language 'plpgsql'; + +create or replace function wp_slide__delete(integer) +returns integer as ' +declare + p_slide_item_id alias for $1; + del_rec record; + v_sort_key cr_wp_slides.sort_key%TYPE; + v_pres_item_id cr_items.item_id%TYPE; + v_preamble_item_id cr_items.item_id%TYPE; + v_postamble_item_id cr_items.item_id%TYPE; + v_bullet_items_item_id cr_items.item_id%TYPE; +begin + for del_rec in + select item_id as attach_item_id + from cr_items + where content_type in + (''cr_wp_image_attachment'', ''cr_wp_file_attachment'') + and parent_id = p_slide_item_id + loop + perform wp_attachment__delete(del_rec.attach_item_id); + end loop; + + select item_id into v_preamble_item_id + from cr_items + where content_type = ''cr_wp_slide_preamble'' + and parent_id = p_slide_item_id; + + perform wp_slide__delete_preamble(v_preamble_item_id); + + select item_id into v_postamble_item_id + from cr_items + where content_type = ''cr_wp_slide_postamble'' + and parent_id = p_slide_item_id; + + perform wp_slide__delete_postamble(v_postamble_item_id); + + select item_id into v_bullet_items_item_id + from cr_items + where content_type = ''cr_wp_slide_bullet_items'' + and parent_id = p_slide_item_id; + + perform wp_slide__delete_bullet_items(v_bullet_items_item_id); + + -- sort_key of all revisions should be the same + select max(s.sort_key), max(i.parent_id) into v_sort_key, v_pres_item_id + from cr_wp_slides s, cr_revisions r, cr_items i + where r.item_id = p_slide_item_id + and r.revision_id = s.slide_id + and i.item_id = r.item_id; + + delete from cr_wp_slides where exists (select 1 from cr_revisions + where cr_revisions.revision_id = cr_wp_slides.slide_id + and cr_revisions.item_id = p_slide_item_id); + + update cr_wp_slides set sort_key = sort_key - 1 + where sort_key > v_sort_key and exists + (select 1 from cr_revisions r, cr_items i + where i.parent_id = v_pres_item_id and i.item_id = r.item_id + and r.revision_id = cr_wp_slides.slide_id); + +-- update acs_objects set context_id=null +-- where context_id = p_slide_item_id; + + delete from cr_item_publish_audit where item_id = p_slide_item_id; + + perform content_item__delete(p_slide_item_id); + + return 0; +end;' language 'plpgsql'; + +create or replace function wp_slide__get_preamble_revision (integer) +returns text as ' +declare + p_slide_revision_id alias for $1; +begin + return content + from cr_revisions r, cr_wp_slides_preamble sp + where sp.slide_id = p_slide_revision_id + and r.revision_id = sp.id; +end;' language 'plpgsql'; + +create or replace function wp_slide__get_postamble_revision (integer) +returns text as ' +declare + p_slide_revision_id alias for $1; +begin + return content + from cr_revisions r, cr_wp_slides_postamble sp + where sp.slide_id = p_slide_revision_id + and r.revision_id = sp.id; +end;' language 'plpgsql'; + +create or replace function wp_slide__get_bullet_items_revision (integer) +returns text as ' +declare + p_slide_revision_id alias for $1; +begin + return content + from cr_revisions r, cr_wp_slides_bullet_items sp + where sp.slide_id = p_slide_revision_id + and r.revision_id = sp.id; +end;' language 'plpgsql'; + +create or replace function wp_slide__get_postamble(integer) +returns text as ' +declare + p_slide_item_id alias for $1; +begin + return content + from cr_revisions, cr_items + where cr_items.content_type = ''cr_wp_slide_postamble'' + and cr_items.parent_id = p_slide_item_id + and cr_revisions.revision_id = cr_items.live_revision; +end;' language 'plpgsql'; + +create or replace function wp_slide__get_preamble(integer) +returns text as' +declare + p_slide_item_id alias for $1; +begin + return content + from cr_revisions, cr_items + where cr_items.content_type = ''cr_wp_slide_preamble'' + and cr_items.parent_id = p_slide_item_id + and cr_revisions.revision_id = cr_items.live_revision; +end;' language 'plpgsql'; + +create or replace function wp_slide__get_bullet_items(integer) +returns text as ' +declare + p_slide_item_id alias for $1; +begin + return content + from cr_revisions, cr_items + where cr_items.content_type = ''cr_wp_slide_bullet_items'' + and cr_items.parent_id = p_slide_item_id + and cr_revisions.revision_id = cr_items.live_revision; +end;' language 'plpgsql'; + +create or replace function wp_slide__new_revision( + timestamptz, + integer, + varchar, + integer, + varchar, + text, + varchar, + varchar, + integer, + integer, + integer, + boolean, + boolean +) returns integer as' +declare + p_creation_date alias for $1; + p_creation_user alias for $2; + p_creation_ip alias for $3; + p_slide_item_id alias for $4; + p_slide_title alias for $5; + p_preamble alias for $6; + p_bullet_items alias for $7; + p_postamble alias for $8; + p_style alias for $9; + p_original_slide_id alias for $10; + p_sort_key alias for $11; + p_include_in_outline_p alias for $12; + p_context_break_after_p alias for $13; + v_preamble_item_id cr_items.item_id%TYPE; + v_postamble_item_id cr_items.item_id%TYPE; + v_bullet_items_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_preamble_revision_id cr_revisions.revision_id%TYPE; + v_postamble_revision_id cr_revisions.revision_id%TYPE; + v_bullet_items_revision_id cr_revisions.revision_id%TYPE; +begin + v_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + null, + p_slide_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_revision_id); + + insert into cr_wp_slides ( + slide_id, + slide_title, + style, + original_slide_id, + sort_key, + include_in_outline_p, + context_break_after_p + ) values ( + v_revision_id, + p_slide_title, + p_style, + p_original_slide_id, + p_sort_key, + p_include_in_outline_p, + p_context_break_after_p + ); + + select item_id into v_preamble_item_id + from cr_items + where parent_id = p_slide_item_id + and content_type = ''cr_wp_slide_preamble''; + + v_preamble_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_preamble, + v_preamble_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_preamble_revision_id); + + insert into cr_wp_slides_preamble + (id, slide_id) + values + (v_preamble_revision_id, v_revision_id); + + select item_id into v_postamble_item_id + from cr_items + where parent_id = p_slide_item_id + and content_type = ''cr_wp_slide_postamble''; + + v_postamble_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_postamble, + v_postamble_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_postamble_revision_id); + + insert into cr_wp_slides_postamble + (id, slide_id) + values + (v_postamble_revision_id, v_revision_id); + + select item_id into v_bullet_items_item_id + from cr_items + where parent_id = p_slide_item_id + and content_type = ''cr_wp_slide_bullet_items''; + + v_bullet_items_revision_id := content_revision__new( + null, + null, + current_timestamp, + ''text/plain'', + null, + p_bullet_items, + v_bullet_items_item_id, + null, + p_creation_date, + p_creation_user, + p_creation_ip + ); + + perform content_item__set_live_revision(v_bullet_items_revision_id); + + insert into cr_wp_slides_bullet_items + (id, slide_id) + values + (v_bullet_items_revision_id, v_revision_id); + + return 0; +end;' language 'plpgsql'; + +-- bug fixed, delete first an image then a file, roc@ +create or replace function wp_attachment__delete(integer) +returns integer as ' +declare + p_attach_item_id alias for $1; +begin + delete from cr_wp_image_attachments + where exists (select 1 from cr_revisions where revision_id + = cr_wp_image_attachments.attach_id + and item_id = p_attach_item_id); + + delete from cr_wp_file_attachments + where exists (select 1 from cr_revisions where revision_id + = cr_wp_file_attachments.attach_id + and item_id = p_attach_item_id); + + delete from cr_item_publish_audit + where item_id = p_attach_item_id; + + perform content_item__delete(p_attach_item_id); + + return 0; +end;' language 'plpgsql'; + +create or replace function wp_attachment__new_revision (integer) +returns integer as ' +declare + p_attach_item_id alias for $1; +begin + return 0; +end; 'language 'plpgsql'; + +create or replace function wp_presentation__set_live_revision(integer) +returns integer as ' +declare + p_revision_id alias for $1; + v_revision_id integer; +begin + perform content_item__set_live_revision(p_revision_id); + + select id into v_revision_id + from cr_wp_presentations_aud + where presentation_id = p_revision_id; + + perform content_item__set_live_revision(v_revision_id); + + select id into v_revision_id + from cr_wp_presentations_back + where presentation_id = p_revision_id; + + perform content_item__set_live_revision(v_revision_id); + return 0; +end;' language 'plpgsql'; + + +-- style functions roc@ +create or replace function wp_style__delete(integer) +returns integer as ' +declare + p_style_id alias for $1; + v_item_id integer; + one_image record; +begin + for one_image in + select * from wp_style_images where wp_style_images_id = + (select background_image from wp_styles where style_id = p_style_id) + loop + delete from wp_style_images + where wp_style_images_id = one_image.wp_style_images_id; + + select item_id into v_item_id + from cr_revisions + where revision_id = one_image.wp_style_images_id; + + perform content_item__delete(v_item_id); + end loop; + + update cr_wp_slides set style = -1 where style = p_style_id; + update cr_wp_presentations set style = -1 where style = p_style_id; + delete from wp_styles where style_id = p_style_id; + + return 0; +end;' language 'plpgsql'; + +create or replace function wp_style__image_delete(integer) +returns integer as ' +declare + p_revision_id alias for $1; + v_item_id integer; +begin + update wp_styles set background_image = 0 + where background_image = p_revision_id; + + delete from wp_style_images + where wp_style_images_id = p_revision_id; + + select item_id into v_item_id from cr_revisions + where revision_id = p_revision_id; + + perform content_item__delete(v_item_id); + + return 0; +end;' language 'plpgsql'; + + Index: openacs-4/packages/wp-slim/sql/postgresql/wp-slim-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/postgresql/wp-slim-create.sql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/wp-slim/sql/postgresql/wp-slim-create.sql 17 May 2003 12:49:58 -0000 1.7 +++ openacs-4/packages/wp-slim/sql/postgresql/wp-slim-create.sql 28 Aug 2003 09:42:00 -0000 1.8 @@ -38,27 +38,51 @@ from dual where not exists (select 1 from cr_mime_types where mime_type ='application/octet-stream'); ---jackp: Create the different styles + +create sequence wp_style_seq; + create table wp_styles ( style_id integer constraint wp_styles_style_id_pk primary key, name varchar(400) constraint wp_styles_name_nn not null, - css varchar(4000), + css text, text_color varchar(20) check(text_color like '%,%,%'), background_color varchar(20) check(background_color like '%,%,%'), - background_image varchar(200), + background_image integer default 0, link_color varchar(20) check(link_color like '%,%,%'), alink_color varchar(20) check(alink_color like '%,%,%'), - vlink_color varchar(20) check(vlink_color like '%,%,%') + vlink_color varchar(20) check(vlink_color like '%,%,%'), + public_p char(1) default 'f' check(public_p in ('t','f')), + owner integer + constraint wp_styles_to_users + references users (user_id) ); + insert into wp_styles(style_id, name, css) values(-1, 'Default (Plain)', 'BODY { back-color: white; color: black } P { line-height: 120% } UL { line-height: 140% }'); +-- this is also a new index! roc@ +create index wp_styles_by_owner on wp_styles(owner); + +-- new table for supporting background images! +-- Images used for styles. + +create table wp_style_images ( +-- this one references to a cr! + wp_style_images_id integer primary key, + style_id integer references wp_styles(style_id) on delete cascade not null, + file_size integer not null, + file_name varchar(200) not null +); + +create index wp_style_images_style_id on wp_style_images(style_id); + + --jackp: p_create the presentation table create table cr_wp_presentations ( presentation_id integer @@ -84,7 +108,10 @@ -- Show last-modified date for slide? show_modified_p boolean constraint cr_wp_show_p_ck - check(show_modified_p in ('t','f')) + check(show_modified_p in ('t','f')), + show_comments_p char(1) default 'f' + constraint cr_wp_comments_p + check(show_comments_p in ('t','f')) ); @@ -684,6 +711,7 @@ select inline_10 (); drop function inline_10 (); + --jackp: set the permissions applicable to the package create function inline_11 () returns integer as' @@ -694,1132 +722,32 @@ begin default_context := acs__magic_object_id(''default_context''); registered_users := acs__magic_object_id(''registered_users''); - the_public := acs__magic_object_id(''the_public''); +-- the_public := acs__magic_object_id(''the_public''); PERFORM acs_permission__grant_permission( default_context, registered_users, ''wp_create_presentation'' ); - PERFORM acs_permission__grant_permission( - default_context, - the_public, - ''wp_view_presentation'' - ); +-- this commented out because permission, with this any user could see an slide that has not become public! +-- PERFORM acs_permission__grant_permission( +-- default_context, +-- the_public, +-- ''wp_view_presentation'' +-- ); return 0; end;' language 'plpgsql'; select inline_11 (); drop function inline_11 (); ---jackp: From here on the functions are defined +-- new permissions roc@ +select acs_privilege__add_child('wp_edit_presentation', 'wp_view_presentation'); +select acs_privilege__add_child('wp_admin_presentation', 'wp_create_presentation'); +select acs_privilege__add_child('wp_admin_presentation', 'wp_edit_presentation'); +select acs_privilege__add_child('wp_admin_presentation', 'wp_delete_presentation'); ---jackp: To p_create each presentation -create function wp_presentation__new ( - timestamptz, - integer, - varchar(400), - varchar(400), - varchar(400), - varchar, - integer, - boolean, - boolean, - varchar, - varchar, - integer -) -returns integer as' -declare - p_creation_date alias for $1; - p_creation_user alias for $2; - p_creation_ip alias for $3; - p_pres_title alias for $4; - p_page_signature alias for $5; - p_copyright_notice alias for $6; - p_style alias for $7; - p_public_p alias for $8; - p_show_modified_p alias for $9; - aud alias for $10; - back alias for $11; - p_parent_id alias for $12; - v_item_id cr_items.item_id%TYPE; - v_audience_item_id cr_items.item_id%TYPE; - v_background_item_id cr_items.item_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; - v_audience_revision_id cr_revisions.revision_id%TYPE; - v_background_revision_id cr_revisions.revision_id%TYPE; - v_max_id integer; - v_name cr_wp_presentations.pres_title%TYPE; -begin - select coalesce(max(item_id),0) into v_max_id - from cr_items - where content_type = ''cr_wp_presentation'' - and name like p_pres_title || ''%''; - - v_name := p_pres_title || ''_'' || v_max_id; +-- lets give site-wide permissions, wp-permissions! +select acs_privilege__add_child('admin', 'wp_admin_presentation'); - v_item_id := content_item__new( - v_name, - p_parent_id, - null, - null, - p_creation_date, - p_creation_user, - null, - p_creation_ip, - ''content_item'', - ''cr_wp_presentation'', - null, - null, - ''text/plain'', - null, - null, - ''text'' - ); - v_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - null, - v_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_revision_id); - ---jackp: Actually place the information entered by the user into the table - insert into cr_wp_presentations - ( - presentation_id, - pres_title, - page_signature, - copyright_notice, - style, - public_p, - show_modified_p - ) values ( - v_revision_id, - p_pres_title, - p_page_signature, - p_copyright_notice, - p_style, - p_public_p, - p_show_modified_p - ); - - v_audience_item_id := content_item__new( - aud, - v_item_id, - null, - null, - p_creation_date, - p_creation_user, - null, - p_creation_ip, - ''content_item'', - ''cr_wp_presentation_aud'', - null, - null, - ''text/plain'', - null, - null, - ''text'' - ); - - v_audience_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - aud, - v_audience_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_audience_revision_id); - - insert into cr_wp_presentations_aud - ( - id, - presentation_id - ) values ( - v_audience_revision_id, - v_revision_id - ); - - v_background_item_id := content_item__new( - back, - v_item_id, - null, - null, - p_creation_date, - p_creation_user, - null, - p_creation_ip, - ''content_item'', - ''cr_wp_presentation_back'', - null, - null, - ''text/plain'', - null, - null, - ''text'' - ); - - v_background_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - back, - v_background_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_background_revision_id); - - insert into cr_wp_presentations_back - ( - id, - presentation_id - ) values ( - v_background_revision_id, - v_revision_id - ); - - return v_item_id; -end;' language 'plpgsql'; - -create function wp_presentation__delete_audience ( - integer -) -returns integer as' -declare - audience_item_id alias for $1; -begin - delete from cr_wp_presentations_aud - where exists (select 1 from cr_revisions where revision_id = cr_wp_presentations_aud.id and item_id = audience_item_id); - delete from cr_item_publish_audit - where item_id = audience_item_id; - - PERFORM content_item__delete(audience_item_id); -return 0; -end;' language 'plpgsql'; - -create function wp_presentation__delete_background ( - integer -) -returns integer as' -declare - background_item_id alias for $1; -begin - delete from cr_wp_presentations_back - where exists (select 1 from cr_revisions where revision_id = cr_wp_presentations_back.id and item_id = background_item_id); - delete from cr_item_publish_audit - where item_id = background_item_id; - - PERFORM content_item__delete(background_item_id); - return 0; -end;' language 'plpgsql'; - -create function wp_presentation__delete ( - integer -) -returns integer as' -declare - pres_item_id alias for $1; - v_audience_item_id cr_items.item_id%TYPE; - v_background_item_id cr_items.item_id%TYPE; - del_rec record; -begin - for del_rec in select item_id as slide_item_id - from cr_items - where content_type = ''cr_wp_slide'' - and parent_id = pres_item_id - loop - PERFORM wp_slide__delete(del_rec.slide_item_id); - end loop; - - select item_id into v_audience_item_id - from cr_items - where content_type = ''cr_wp_presentation_aud'' - and parent_id = pres_item_id; - - PERFORM wp_presentation__delete_audience(v_audience_item_id); - - select item_id into v_background_item_id - from cr_items - where content_type = ''cr_wp_presentation_back'' - and parent_id = pres_item_id; - - PERFORM wp_presentation__delete_background(v_background_item_id); - - delete from acs_permissions where object_id = pres_item_id; - -- update acs_objects set context_id=null where context_id = pres_item_id; - delete from cr_wp_presentations where exists (select 1 from cr_revisions where cr_revisions.revision_id = cr_wp_presentations.presentation_id and cr_revisions.item_id = pres_item_id); - PERFORM content_item__delete(pres_item_id); -return 0; -end;' language 'plpgsql'; - --- DRB: All these could've been implemented as a single function with a type argument --- but I'm not going to rewrite all of wp-slim's queries just to clean this up... - -create function wp_presentation__get_ad_revision (integer) returns text as ' -declare - p_pres_revision_id alias for $1; -begin - return r.content - from cr_revisions r, - cr_wp_presentations_aud pa - where pa.presentation_id = p_pres_revision_id - and r.revision_id = pa.id; -end;' language 'plpgsql'; - -create function wp_presentation__get_audience ( - integer -) returns text as' -declare - p_pres_item_id alias for $1; -begin - return content - from cr_revisions, cr_items - where cr_items.content_type = ''cr_wp_presentation_aud'' - and cr_items.parent_id = p_pres_item_id - and cr_revisions.revision_id = cr_items__live_revision; -end;' language 'plpgsql'; - -create function wp_presentation__get_bg_revision (integer) returns text as ' -declare - p_pres_revision_id alias for $1; -begin - return r.content - from cr_revisions r, - cr_wp_presentations_aud pa - where pa.presentation_id = p_pres_revision_id - and r.revision_id = pa.id; -end;' language 'plpgsql'; - -create function wp_presentation__get_background ( - integer -) returns text as' -declare - pres_item_id alias for $1; -begin - return content - from cr_revisions, cr_items - where cr_items.content_type = ''cr_wp_presentation_bak'' - and cr_items.parent_id = p_pres_item_id - and cr_revisions.revision_id = cr_items__live_revision; -end;' language 'plpgsql'; - - -create function wp_presentation__new_revision ( - timestamptz, - integer, - varchar, - integer, - varchar(400), - varchar(200), - varchar(400), - integer, - boolean, - boolean, - varchar, - varchar -) returns integer as' -declare - p_creation_date alias for $1; - p_creation_user alias for $2; - p_creation_ip alias for $3; - p_pres_item_id alias for $4; - p_pres_title alias for $5; - p_page_signature alias for $6; - p_copyright_notice alias for $7; - p_style alias for $8; - p_public_p alias for $9; - p_show_modified_p alias for $10; - p_audience alias for $11; - p_background alias for $12; - v_audience_item_id cr_items.item_id%TYPE; - v_background_item_id cr_items.item_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; - v_audience_revision_id cr_revisions.revision_id%TYPE; - v_background_revision_id cr_revisions.revision_id%TYPE; -begin - v_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - null, - p_pres_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_revision_id); - - insert into cr_wp_presentations - ( - presentation_id, - pres_title, - page_signature, - copyright_notice, - style, - public_p, - show_modified_p - ) values ( - v_revision_id, - p_pres_title, - p_page_signature, - p_copyright_notice, - p_style, - p_public_p, - p_show_modified_p - ); - - select item_id into v_audience_item_id - from cr_items - where parent_id = p_pres_item_id - and content_type = ''cr_wp_presentation_aud''; - - v_audience_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - p_audience, - v_audience_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_audience_revision_id); - - insert into cr_wp_presentations_aud - ( - id, - presentation_id - ) values ( - v_audience_revision_id, - v_revision_id - ); - - select item_id into v_background_item_id - from cr_items - where parent_id = p_pres_item_id - and content_type = ''cr_wp_presentation_back''; - - v_background_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - p_background, - v_background_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_background_revision_id); - - insert into cr_wp_presentations_back - ( - id, - presentation_id - ) values ( - v_background_revision_id, - v_revision_id - ); - return 0; -end;' language 'plpgsql'; - -create function wp_slide__new ( - integer, - timestamptz, - integer, - varchar, - varchar, - integer, - integer, - integer, - varchar, - varchar, - varchar, - boolean, - boolean, - integer -) returns integer as' -declare - p_pres_item_id alias for $1; - p_creation_date alias for $2; - p_creation_user alias for $3; - p_creation_ip alias for $4; - p_slide_title alias for $5; - p_style alias for $6; - p_original_slide_id alias for $7; - p_sort_key alias for $8; - p_preamble alias for $9; - p_bullet_items alias for $10; - p_postamble alias for $11; - p_include_in_outline_p alias for $12; - p_context_break_after_p alias for $13; - p_context_id alias for $14; - v_item_id cr_items.item_id%TYPE; - v_preamble_item_id cr_items.item_id%TYPE; - v_postamble_item_id cr_items.item_id%TYPE; - v_bullet_items_item_id cr_items.item_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; - v_preamble_revision_id cr_revisions.revision_id%TYPE; - v_postamble_revision_id cr_revisions.revision_id%TYPE; - v_bullet_items_revision_id cr_revisions.revision_id%TYPE; - v_max_id integer; - v_name varchar; -begin - select coalesce(max(item_id),0) into v_max_id - from cr_items - where content_type = ''cr_wp_slide'' - and name like p_slide_title || ''%''; - - v_name := p_slide_title || ''_'' || v_max_id; - - v_item_id := content_item__new( - v_name, - p_pres_item_id, - null, - null, - p_creation_date, - p_creation_user, - null, - p_creation_ip, - ''content_item'', - ''cr_wp_slide'', - null, - null, - ''text/plain'', - null, - null, - ''text'' - ); - - v_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - null, - v_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_revision_id); - - update cr_wp_slides - set sort_key = sort_key + 1 - where sort_key >= p_sort_key - and exists (select 1 from cr_items, cr_revisions where parent_id = - p_pres_item_id and cr_items.item_id = cr_revisions.item_id - and cr_revisions.revision_id=cr_wp_slides.slide_id); - - insert into cr_wp_slides - ( - slide_id, - original_slide_id, - sort_key, - slide_title, - include_in_outline_p, - context_break_after_p, - style - ) values ( - v_revision_id, - p_original_slide_id, - p_sort_key, - p_slide_title, - p_include_in_outline_p, - p_context_break_after_p, - p_style - ); - - v_preamble_item_id := content_item__new( - ''preamble'', - v_item_id, - null, - null, - p_creation_date, - p_creation_user, - null, - p_creation_ip, - ''content_item'', - ''cr_wp_slide_preamble'', - null, - null, - ''text/plain'', - null, - null, - ''text'' - ); - - v_preamble_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - p_preamble, - v_preamble_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_preamble_revision_id); - - insert into cr_wp_slides_preamble - ( - id, - slide_id - ) values ( - v_preamble_revision_id, - v_revision_id - ); - - v_postamble_item_id := content_item__new( - ''postamble'', - v_item_id, - null, - null, - p_creation_date, - p_creation_user, - null, - p_creation_ip, - ''content_item'', - ''cr_wp_slide_postamble'', - null, - null, - ''text/plain'', - null, - null, - ''text'' - ); - - - v_postamble_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - p_postamble, - v_postamble_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_postamble_revision_id); - - insert into cr_wp_slides_postamble - ( - id, - slide_id - ) values ( - v_postamble_revision_id, - v_revision_id - ); - - v_bullet_items_item_id := content_item__new( - ''bullet_items'', - v_item_id, - null, - null, - p_creation_date, - p_creation_user, - null, - p_creation_ip, - ''content_item'', - ''cr_wp_slide_bullet_items'', - null, - null, - null, - ''text/plain'', - null, - ''text'' - ); - - - v_bullet_items_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - p_bullet_items, - v_bullet_items_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_bullet_items_revision_id); - - insert into cr_wp_slides_bullet_items - ( - id, - slide_id - ) values ( - v_bullet_items_revision_id, - v_revision_id - ); - return v_item_id; -end;' language 'plpgsql'; - -create function wp_slide__delete_preamble ( - integer -) returns integer as' -declare - delete_preamble__preamble_item_id alias for $1; -begin - delete from cr_wp_slides_preamble - where exists (select 1 from cr_revisions where revision_id = - cr_wp_slides_preamble.id - and item_id = delete_preamble__preamble_item_id); - - delete from cr_item_publish_audit - where item_id = delete_preamble__preamble_item_id; - - PERFORM content_item__delete(delete_preamble__preamble_item_id); - return 0; -end;' language 'plpgsql'; - -create function wp_slide__delete_postamble( - integer -) returns integer as' -declare - delete_postamble__postamble_item_id alias for $1; -begin - delete from cr_wp_slides_postamble - where exists (select 1 from cr_revisions where revision_id = - cr_wp_slides_postamble.id - and item_id = delete_postamble__postamble_item_id); - - delete from cr_item_publish_audit - where item_id = delete_postamble__postamble_item_id; - - PERFORM content_item__delete(delete_postamble__postamble_item_id); - return 0; -end;' language 'plpgsql'; - -create function wp_slide__delete_bullet_items( - integer -) returns integer as' -declare - delete_bullet_items__bullet_items_item_id alias for $1; -begin - delete from cr_wp_slides_bullet_items - where exists (select 1 from cr_revisions where revision_id = - cr_wp_slides_bullet_items.id - and item_id = delete_bullet_items__bullet_items_item_id); - - delete from cr_item_publish_audit - where item_id = delete_bullet_items__bullet_items_item_id; - - PERFORM content_item__delete(delete_bullet_items__bullet_items_item_id); - return 0; -end;' language 'plpgsql'; - -create function wp_slide__delete( - integer -) returns integer as' -declare - del_rec record; - slide_item_id alias for $1; - v_sort_key cr_wp_slides.sort_key%TYPE; - v_pres_item_id cr_items.item_id%TYPE; - v_preamble_item_id cr_items.item_id%TYPE; - v_postamble_item_id cr_items.item_id%TYPE; - v_bullet_items_item_id cr_items.item_id%TYPE; -begin - for del_rec in select item_id as attach_item_id - from cr_items - where content_type in (''cr_wp_image_attachment'', ''cr_wp_file_attachment'') - and parent_id = slide_item_id - loop - wp_attachment__delete(del_rec.attach_item_id); - end loop; - - select item_id into v_preamble_item_id - from cr_items - where content_type = ''cr_wp_slide_preamble'' - and parent_id = slide_item_id; - - PERFORM wp_slide__delete_preamble(v_preamble_item_id); - - select item_id into v_postamble_item_id - from cr_items - where content_type = ''cr_wp_slide_postamble'' - and parent_id = slide_item_id; - - PERFORM wp_slide__delete_postamble(v_postamble_item_id); - - select item_id into v_bullet_items_item_id - from cr_items - where content_type = ''cr_wp_slide_bullet_items'' - and parent_id = slide_item_id; - - PERFORM wp_slide__delete_bullet_items(v_bullet_items_item_id); - --- sort_key of all revisions should be the same - select max(s.sort_key), max(i.parent_id) into v_sort_key, - v_pres_item_id - from cr_wp_slides s, cr_revisions r, cr_items i - where r.item_id = slide_item_id - and r.revision_id = s.slide_id - and i.item_id = r.item_id; - - delete from cr_wp_slides where exists (select 1 from cr_revisions - where cr_revisions.revision_id = cr_wp_slides.slide_id - and cr_revisions.item_id = slide_item_id); - - update cr_wp_slides set sort_key = sort_key - 1 - where sort_key > v_sort_key and exists - (select 1 from cr_revisions r, cr_items i - where i.parent_id = v_pres_item_id and i.item_id = r.item_id - and r.revision_id = cr_wp_slides.slide_id); - --- update acs_objects set context_id=null --- where context_id = slide_item_id; - - delete from cr_item_publish_audit where item_id = slide_item_id; - - PERFORM content_item__delete(slide_item_id); - return 0; -end;' language 'plpgsql'; - -create function wp_slide__get_preamble_revision ( - integer -) returns text as ' -declare - p_slide_revision_id alias for $1; -begin - return content - from cr_revisions r, cr_wp_slides_preamble sp - where sp.slide_id = p_slide_revision_id - and r.revision_id = sp.id; -end;' language 'plpgsql'; - -create function wp_slide__get_postamble_revision ( - integer -) returns text as ' -declare - p_slide_revision_id alias for $1; -begin - return content - from cr_revisions r, cr_wp_slides_postamble sp - where sp.slide_id = p_slide_revision_id - and r.revision_id = sp.id; -end;' language 'plpgsql'; - -create function wp_slide__get_bullet_items_revision ( - integer -) returns text as ' -declare - p_slide_revision_id alias for $1; -begin - return content - from cr_revisions r, cr_wp_slides_bullet_items sp - where sp.slide_id = p_slide_revision_id - and r.revision_id = sp.id; -end;' language 'plpgsql'; - -create function wp_slide__get_postamble( - integer -) returns text as ' -declare - p_slide_item_id alias for $1; -begin - return content - from cr_revisions, cr_items - where cr_items.content_type = ''cr_wp_slide_postamble'' - and cr_items.parent_id = p_slide_item_id - and cr_revisions.revision_id = cr_items.live_revision; -end;' language 'plpgsql'; - -create function wp_slide__get_preamble( - integer -) returns text as' -declare - p_slide_item_id alias for $1; -begin - return content - from cr_revisions, cr_items - where cr_items.content_type = ''cr_wp_slide_preamble'' - and cr_items.parent_id = p_slide_item_id - and cr_revisions.revision_id = cr_items.live_revision; -end;' language 'plpgsql'; - -create function wp_slide__get_bullet_items( - integer -) returns text as' -declare - p_slide_item_id alias for $1; -begin - return content - from cr_revisions, cr_items - where cr_items.content_type = ''cr_wp_slide_bullet_items'' - and cr_items.parent_id = p_slide_item_id - and cr_revisions.revision_id = cr_items.live_revision; -end;' language 'plpgsql'; - -create function wp_slide__new_revision( - timestamptz, - integer, - varchar, - integer, - varchar, - text, - varchar, - varchar, - integer, - integer, - integer, - boolean, - boolean -) returns integer as' -declare - p_creation_date alias for $1; - p_creation_user alias for $2; - p_creation_ip alias for $3; - p_slide_item_id alias for $4; - p_slide_title alias for $5; - p_preamble alias for $6; - p_bullet_items alias for $7; - p_postamble alias for $8; - p_style alias for $9; - p_original_slide_id alias for $10; - p_sort_key alias for $11; - p_include_in_outline_p alias for $12; - p_context_break_after_p alias for $13; - v_preamble_item_id cr_items.item_id%TYPE; - v_postamble_item_id cr_items.item_id%TYPE; - v_bullet_items_item_id cr_items.item_id%TYPE; - v_revision_id cr_revisions.revision_id%TYPE; - v_preamble_revision_id cr_revisions.revision_id%TYPE; - v_postamble_revision_id cr_revisions.revision_id%TYPE; - v_bullet_items_revision_id cr_revisions.revision_id%TYPE; -begin - v_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - null, - p_slide_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_revision_id); - - insert into cr_wp_slides - ( - slide_id, - slide_title, - style, - original_slide_id, - sort_key, - include_in_outline_p, - context_break_after_p - ) values ( - v_revision_id, - p_slide_title, - p_style, - p_original_slide_id, - p_sort_key, - p_include_in_outline_p, - p_context_break_after_p - ); - - select item_id into v_preamble_item_id - from cr_items - where parent_id = p_slide_item_id - and content_type = ''cr_wp_slide_preamble''; - - v_preamble_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - p_preamble, - v_preamble_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_preamble_revision_id); - - insert into cr_wp_slides_preamble - ( - id, - slide_id - ) values ( - v_preamble_revision_id, - v_revision_id - ); - - select item_id into v_postamble_item_id - from cr_items - where parent_id = p_slide_item_id - and content_type = ''cr_wp_slide_postamble''; - - v_postamble_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - p_postamble, - v_postamble_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_postamble_revision_id); - - insert into cr_wp_slides_postamble - ( - id, - slide_id - ) values ( - v_postamble_revision_id, - v_revision_id - ); - - select item_id into v_bullet_items_item_id - from cr_items - where parent_id = p_slide_item_id - and content_type = ''cr_wp_slide_bullet_items''; - - v_bullet_items_revision_id := content_revision__new( - null, - null, - current_timestamp, - ''text/plain'', - null, - p_bullet_items, - v_bullet_items_item_id, - null, - p_creation_date, - p_creation_user, - p_creation_ip - ); - - PERFORM content_item__set_live_revision(v_bullet_items_revision_id); - - insert into cr_wp_slides_bullet_items - ( - id, - slide_id - ) values ( - v_bullet_items_revision_id, - v_revision_id - ); - return 0; -end;' language 'plpgsql'; - -create function wp_attachment__delete( - integer -) returns integer as' -declare - p_attach_item_id alias for $1; -begin - delete from cr_wp_file_attachments - where exists (select 1 from cr_revisions where revision_id - = cr_wp_file_attachments.attach_id - and item_id = p_attach_item_id); - - delete from cr_wp_image_attachments - where exists (select 1 from cr_revisions where revision_id - = cr_wp_image_attachments.attach_id - and item_id = p_attach_item_id); - - delete from cr_item_publish_audit - where item_id = p_attach_item_id; - - PERFORM content_item__delete(p_attach_item_id); - return 0; -end;' language 'plpgsql'; - -create function wp_attachment__new_revision ( - integer -) returns integer as' -declare - p_attach_item_id alias for $1; -begin - return 0; -end; 'language 'plpgsql'; - - - - -create function wp_presentation__set_live_revision(integer) returns integer as ' -declare - p_revision_id alias for $1; - v_revision_id integer; -begin - perform content_item__set_live_revision(p_revision_id); - - select id into v_revision_id - from cr_wp_presentations_aud - where presentation_id = p_revision_id; - - perform content_item__set_live_revision(v_revision_id); - - select id into v_revision_id - from cr_wp_presentations_back - where presentation_id = p_revision_id; - - perform content_item__set_live_revision(v_revision_id); - return 0; -end;' language 'plpgsql'; - - - Index: openacs-4/packages/wp-slim/sql/postgresql/wp-slim-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/postgresql/wp-slim-drop.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/sql/postgresql/wp-slim-drop.sql 17 May 2003 12:49:58 -0000 1.4 +++ openacs-4/packages/wp-slim/sql/postgresql/wp-slim-drop.sql 28 Aug 2003 09:42:00 -0000 1.5 @@ -315,26 +315,35 @@ default_context := acs__magic_object_id(''default_context''); registered_users := acs__magic_object_id(''registered_users''); - the_public := acs__magic_object_id(''the_public''); +-- the_public := acs__magic_object_id(''the_public''); PERFORM acs_permission__revoke_permission ( default_context, registered_users, ''wp_create_presentation'' ); - PERFORM acs_permission__revoke_permission ( - default_context, - the_public, - ''wp_view_presentation'' - ); +-- PERFORM acs_permission__revoke_permission ( +-- default_context, +-- the_public, +-- ''wp_view_presentation'' +-- ); return 0; end;' language 'plpgsql'; select inline_11 (); drop function inline_11 (); --checked + +select acs_privilege__remove_child('admin', 'wp_admin_presentation'); + +select acs_privilege__remove_child('wp_edit_presentation', 'wp_view_presentation'); +select acs_privilege__remove_child('wp_admin_presentation', 'wp_create_presentation'); +select acs_privilege__remove_child('wp_admin_presentation', 'wp_edit_presentation'); +select acs_privilege__remove_child('wp_admin_presentation', 'wp_delete_presentation'); + + create function inline_12 () returns integer as' begin @@ -469,9 +478,9 @@ integer, varchar, integer, - varchar(400), - varchar(200), - varchar(400), + varchar, + varchar, + varchar, integer, boolean, boolean, @@ -500,10 +509,19 @@ drop view cr_wp_presentationsx; drop table cr_wp_presentations; -drop table wp_styles; drop function wp_slide__get_bullet_items_revision(integer); drop function wp_slide__get_postamble_revision(integer); drop function wp_slide__get_bullet_items(integer); drop function wp_slide__get_postamble(integer); drop function wp_presentation__set_live_revision(integer); + +drop sequence wp_style_seq; + + +drop function wp_style__delete(integer); + +drop function wp_style__image_delete(integer); +drop table wp_style_images; +drop table wp_styles; + Index: openacs-4/packages/wp-slim/sql/postgresql/upgrade/upgrade-4.0b3-4.1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/sql/postgresql/upgrade/upgrade-4.0b3-4.1.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/sql/postgresql/upgrade/upgrade-4.0b3-4.1.sql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,76 @@ +-- /packages/wp-slim/sql/postgresql/upgrade-4.0b3-4.1.sql + +-- timestamp fixes +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2003-08-06 +-- @cvs-id $Id: upgrade-4.0b3-4.1.sql,v 1.2 2003/08/28 09:42:00 lars Exp $ + +-- why drop the functions instead of just doing create-or-replace? +-- because we're changing the signature, create-or-replace won't find +-- the old functions, so they would linger in the db. drop them explicitly + +drop function wp_presentation__new ( + timestamp, + integer, + varchar(400), + varchar(400), + varchar(400), + varchar, + integer, + boolean, + boolean, + varchar, + varchar, + integer +); + +drop function wp_presentation__new_revision ( + timestamp, + integer, + varchar, + integer, + varchar(400), + varchar(200), + varchar(400), + integer, + boolean, + boolean, + varchar, + varchar +); + +drop function wp_slide__new ( + integer, + timestamp, + integer, + varchar, + varchar, + integer, + integer, + integer, + varchar, + varchar, + varchar, + boolean, + boolean, + integer +); + +drop function wp_slide__new_revision( + timestamp, + integer, + varchar, + integer, + varchar, + text, + varchar, + varchar, + integer, + integer, + integer, + boolean, + boolean +); + +-- now load the new functions +\i ../wp-packages-create.sql Index: openacs-4/packages/wp-slim/tcl/printer-view-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/tcl/printer-view-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/tcl/printer-view-procs-oracle.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,18 @@ + + + oracle8.1.6 + + + + select live_revision as attach_id, display, name as file_name + from (select live_revision, name + from cr_items + where parent_id = :slide_item_id and + content_type in ('cr_wp_image_attachment', 'cr_wp_file_attachment') + ) a, + cr_wp_image_attachments + where a.live_revision = attach_id(+) + + + + Index: openacs-4/packages/wp-slim/tcl/printer-view-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/tcl/printer-view-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/tcl/printer-view-procs-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,17 @@ + + + postgresql7.2 + + + + select live_revision as attach_id, display, name as file_name + from (select live_revision, name + from cr_items + where parent_id = :slide_item_id and + content_type in ('cr_wp_image_attachment', 'cr_wp_file_attachment') + ) a + left join cr_wp_image_attachments on (a.live_revision = attach_id) + + + + Index: openacs-4/packages/wp-slim/tcl/printer-view-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/tcl/printer-view-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/tcl/printer-view-procs.tcl 17 May 2003 12:50:28 -0000 1.2 +++ openacs-4/packages/wp-slim/tcl/printer-view-procs.tcl 28 Aug 2003 09:42:00 -0000 1.3 @@ -7,16 +7,6 @@ slide_item_id } { -db_multirow attach_list get_attachments { - - select live_revision as attach_id, display, name as file_name - from (select live_revision, name - from cr_items - where parent_id = :slide_item_id and - content_type in ('cr_wp_image_attachment', 'cr_wp_file_attachment') - ) a - left join cr_wp_image_attachments on (a.live_revision = attach_id) +db_multirow attach_list get_attachments { *SQL* } } - -} Index: openacs-4/packages/wp-slim/tcl/printer-view-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/tcl/printer-view-procs.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/tcl/printer-view-procs.xql 17 May 2003 12:50:28 -0000 1.2 +++ openacs-4/packages/wp-slim/tcl/printer-view-procs.xql 28 Aug 2003 09:42:00 -0000 1.3 @@ -1,6 +1,6 @@ - + select live_revision as attach_id, display, name as file_name Index: openacs-4/packages/wp-slim/tcl/wp-slim-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/tcl/wp-slim-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/tcl/wp-slim-procs.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,44 @@ +ad_library { + + Wimpy procs +} + +ad_proc wp_header {style_id} { Build the proper style for an specific page. } { + + db_1row get_style_data { *SQL* } + set out "" + if { $background_image != "" } { + append out " background=\"[ad_conn package_url]/view-image?revision_id=$background_image\"" + } + foreach property { + { text text_color } + { bgcolor background_color } + { link link_color } + { vlink vlink_color } + { alink alink_color } + } { + set value [set [lindex $property 1]] + if { $value != "" } { + append out " [lindex $property 0]=[ad_color_to_hex $value]" + } + } + return $out + +} + + +proc_doc wp_check_style_authorization { style_id user_id } { Verifies that the user owns this style. } { + set owner [db_string wp_style_owner_select { *SQL* } -default "not_found"] + if { $owner == "not_found" } { + set err "Error" + set errmsg "Style $style_id was not found in the database." + } else { + set err "Authorization Failed" + set errmsg "You do not have the proper authorization to access this feature." + } + if { $owner != $user_id } { + ad_return_error $err $errmsg + ad_script_abort + } +} + Index: openacs-4/packages/wp-slim/tcl/wp-slim-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/tcl/wp-slim-procs.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/tcl/wp-slim-procs.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,21 @@ + + + + + + + select * from wp_styles where style_id = :style_id + + + + + + + + + select owner from wp_styles where style_id = :style_id + + + + + Index: openacs-4/packages/wp-slim/www/attach-del.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/attach-del.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/attach-del.tcl 4 Oct 2001 04:29:01 -0000 1.2 +++ openacs-4/packages/wp-slim/www/attach-del.tcl 28 Aug 2003 09:42:00 -0000 1.3 @@ -10,8 +10,12 @@ } { slide_item_id:naturalnum,notnull attach_item_id:naturalnum,notnull + pres_item_id:naturalnum,notnull } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_delete_presentation db_exec_plsql revisions_and_item_delete { @@ -20,4 +24,4 @@ end; } -ad_returnredirect "attach-list?[export_url_vars slide_item_id]" +ad_returnredirect "attach-list?[export_url_vars slide_item_id pres_item_id]" Index: openacs-4/packages/wp-slim/www/attach-detail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/attach-detail.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/attach-detail.tcl 6 Sep 2002 15:32:23 -0000 1.4 +++ openacs-4/packages/wp-slim/www/attach-detail.tcl 28 Aug 2003 09:42:00 -0000 1.5 @@ -30,6 +30,11 @@ and item_id = :slide_item_id }] +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + + set context [list [list "edit-slide?[export_url_vars slide_item_id pres_item_id]" "Edit Slide"] "Details"] db_multirow revisions revisions_get { Index: openacs-4/packages/wp-slim/www/attach-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/attach-list.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/attach-list.adp 22 May 2003 15:18:55 -0000 1.4 +++ openacs-4/packages/wp-slim/www/attach-list.adp 28 Aug 2003 09:42:00 -0000 1.5 @@ -4,7 +4,7 @@ Index: openacs-4/packages/wp-slim/www/attach-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/attach-list.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/attach-list.tcl 6 Sep 2002 15:32:23 -0000 1.3 +++ openacs-4/packages/wp-slim/www/attach-list.tcl 28 Aug 2003 09:42:00 -0000 1.4 @@ -10,13 +10,18 @@ @cvs-id $Id$ } { slide_item_id:naturalnum,notnull + pres_item_id:naturalnum,notnull } -properties { slide_item_id context att:multirow } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + set pres_item_id [db_string pres_item_id_get { select parent_id from cr_items Index: openacs-4/packages/wp-slim/www/attach.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/attach.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/wp-slim/www/attach.tcl 17 May 2003 12:50:50 -0000 1.7 +++ openacs-4/packages/wp-slim/www/attach.tcl 28 Aug 2003 09:42:00 -0000 1.8 @@ -70,5 +70,4 @@ ad_script_abort } - ad_returnredirect edit-slide?[export_url_vars slide_item_id pres_item_id] Index: openacs-4/packages/wp-slim/www/create-presentation-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/create-presentation-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/create-presentation-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,19 @@ + + + + postgresql7.1 + + + + + select style_id, (case when owner = :user_id then name || ' (yours)' else name end) as name + from wp_styles + where owner = :user_id + or public_p = 't' + order by name + + + + + + Index: openacs-4/packages/wp-slim/www/create-presentation.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/create-presentation.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/create-presentation.adp 22 May 2003 15:18:55 -0000 1.5 +++ openacs-4/packages/wp-slim/www/create-presentation.adp 28 Aug 2003 09:42:00 -0000 1.6 @@ -16,7 +16,7 @@
    Title:
    @@ -25,7 +25,7 @@
    Page Signature:
    @@ -37,7 +37,7 @@
    Copyright Notice:
    @@ -81,10 +81,7 @@
    Style: + @available_styles@
    Title: +
    @@ -30,7 +30,7 @@
    Page Signature:
    @@ -42,7 +42,7 @@
    Copyright Notice:
    @@ -105,12 +105,7 @@
    Style: - @available_styles@
    Index: openacs-4/packages/wp-slim/www/edit-presentation.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/edit-presentation.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/edit-presentation.tcl 17 May 2003 12:50:50 -0000 1.5 +++ openacs-4/packages/wp-slim/www/edit-presentation.tcl 28 Aug 2003 09:42:00 -0000 1.6 @@ -19,15 +19,15 @@ } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + set header [ad_header "Edit Presentation"] -db_1row get_presentation_data { - select p.pres_title, p.page_signature, p.copyright_notice, p.public_p, p.show_modified_p - from cr_wp_presentations p, cr_items i - where i.item_id = :pres_item_id - and i.live_revision = p.presentation_id -} +db_1row get_presentation_data { *SQL* } + db_1row get_aud_data { select name as audience from cr_revisions, cr_items @@ -53,4 +53,20 @@ set audience [ad_quotehtml $audience] set background [ad_quotehtml $background] +set items [db_list_of_lists wp_styles { *SQL* }] + + set names [list] + set values [list] + foreach image $items { + lappend names [lindex $image 1] + lappend values [lindex $image 0] + } + + lappend names "none" + lappend values -1 + + set available_styles "\n" + + ad_return_template Index: openacs-4/packages/wp-slim/www/edit-presentation.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/edit-presentation.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/edit-presentation.xql 15 Nov 2001 01:47:13 -0000 1.1 +++ openacs-4/packages/wp-slim/www/edit-presentation.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -35,5 +35,16 @@ + + + + select style_id, (case when owner = :user_id then name || ' (yours)' else name end) as name + from wp_styles + where owner = :user_id + or public_p = 't' + order by name + + + Index: openacs-4/packages/wp-slim/www/edit-slide-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/edit-slide-2.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/edit-slide-2.tcl 17 May 2003 12:50:50 -0000 1.5 +++ openacs-4/packages/wp-slim/www/edit-slide-2.tcl 28 Aug 2003 09:42:00 -0000 1.6 @@ -24,12 +24,15 @@ } +#added permission checking roc@ set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + set creation_ip [ad_conn peeraddr] # construct the list of bullet_items set bullet_items [list] -for {set index 1} {$index < [expr $bullet_num + 1]} {incr index} { +for {set index 1} {$index <= [expr $bullet_num + 1]} {incr index} { if {![empty_string_p $bullet($index)]} { lappend bullet_items $bullet($index) } Index: openacs-4/packages/wp-slim/www/edit-slide.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/edit-slide.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/edit-slide.adp 22 May 2003 15:18:55 -0000 1.5 +++ openacs-4/packages/wp-slim/www/edit-slide.adp 28 Aug 2003 09:42:00 -0000 1.6 @@ -71,5 +71,3 @@ - - Index: openacs-4/packages/wp-slim/www/edit-slide.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/Attic/edit-slide.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/edit-slide.tcl 17 May 2003 12:50:50 -0000 1.5 +++ openacs-4/packages/wp-slim/www/edit-slide.tcl 28 Aug 2003 09:42:00 -0000 1.6 @@ -21,8 +21,12 @@ } -set context [list "Edit Slide"] +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation +set context [list "presentation-top?[export_url_vars pres_item_id] {presentation}" {Edit Slide}] + db_1row get_slide_info { select s.slide_title, s.sort_key, @@ -63,6 +67,8 @@ set bullet_num 0 multirow create bullets item widget rows prev +# up to 3 bullets now! roc@ +lappend bullet_items {} {} foreach item $bullet_items { if {[string length $item] < 60} { set rows 1 @@ -74,7 +80,7 @@ multirow append bullets $item $widget $rows $bullet_num incr bullet_num } -incr bullet_num +incr bullet_num set bullet_max [expr $bullet_num + 1] # quote html tags contained in bullet items Index: openacs-4/packages/wp-slim/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/index-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/index-oracle.xql 13 Mar 2002 22:50:53 -0000 1.2 +++ openacs-4/packages/wp-slim/www/index-oracle.xql 28 Aug 2003 09:42:00 -0000 1.3 @@ -3,6 +3,14 @@ oracle8.1.6 + + + + and ao.create_date >= (sysdate - $show_age) + + + + @@ -17,6 +25,7 @@ and ao.creation_user = p.person_id and pres.public_p = 't' and ao.context_id = :package_id + $extra_where_clauses @@ -33,6 +42,7 @@ and ao.object_id = i.item_id and ao.creation_user = :user_id and ao.context_id = :package_id + $extra_where_clauses @@ -52,8 +62,14 @@ and ao.object_id = i.item_id and ao.creation_user <> :user_id and ao.creation_user = p.person_id - and acs_permission.permission_p(i.item_id, :user_id, 'wp_view_presentation') = 't' and ao.context_id = :package_id + $extra_where_clauses + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = i.item_id + and m.party_id = :user_id + and m.privilege = 'wp_view_presentation') + $extra_where_clauses Index: openacs-4/packages/wp-slim/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/index-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/index-postgresql.xql 13 Mar 2002 22:50:53 -0000 1.2 +++ openacs-4/packages/wp-slim/www/index-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.3 @@ -3,6 +3,14 @@ postgresql7.1 + + + + and ao.creation_date >= (current_timestamp - cast('$show_age days' as interval)) + + + + @@ -17,6 +25,7 @@ and ao.creation_user = p.person_id and pres.public_p = 't' and ao.context_id = :package_id + $extra_where_clauses @@ -33,6 +42,7 @@ and ao.object_id = i.item_id and ao.creation_user = :user_id and ao.context_id = :package_id + $extra_where_clauses @@ -41,22 +51,25 @@ - select i.item_id as pres_item_id, - pres.pres_title, - to_char(ao.creation_date, 'Month DD, YYYY') as creation_date, - ao.creation_user, - p.first_names || ' ' || p.last_name as full_name, + select i.item_id as pres_item_id, + pres.pres_title, + to_char(ao.creation_date, 'Month DD, YYYY') as creation_date, + ao.creation_user, + p.first_names || ' ' || p.last_name as full_name, acs_permission__permission_p(i.item_id, :user_id, 'wp_edit_presentation') as edit_p - from cr_items i, cr_wp_presentations pres, persons p, acs_objects ao - where i.live_revision = pres.presentation_id - and ao.object_id = i.item_id - and ao.creation_user <> :user_id - and ao.creation_user = p.person_id - and acs_permission__permission_p(i.item_id, :user_id, 'wp_view_presentation') = 't' - and ao.context_id = :package_id - + from cr_items i, cr_wp_presentations pres, persons p, acs_objects ao + where i.live_revision = pres.presentation_id + and ao.object_id = i.item_id + and ao.creation_user <> :user_id + and ao.creation_user = p.person_id + and ao.context_id = :package_id + $extra_where_clauses + and exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = i.item_id + and m.party_id = :user_id + and m.privilege = 'wp_view_presentation') - Index: openacs-4/packages/wp-slim/www/index-unregistered.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/index-unregistered.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/index-unregistered.adp 6 Sep 2002 21:51:10 -0000 1.3 +++ openacs-4/packages/wp-slim/www/index-unregistered.adp 28 Aug 2003 09:42:00 -0000 1.4 @@ -2,6 +2,49 @@ WimpyPoint + + + + +
    +[ + +Last Week + + +Last Week + +| + +Last Two Weeks + + +Last Two Weeks + +| + +Last Month + + +Last Month + +| + +All + + +All + +] + +

    Options

    + +
    +
    +

    Everyone's Presentations

      @@ -10,8 +53,3 @@
    -

    Options

    - \ No newline at end of file Index: openacs-4/packages/wp-slim/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/index.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/index.adp 22 May 2003 15:18:55 -0000 1.5 +++ openacs-4/packages/wp-slim/www/index.adp 28 Aug 2003 09:42:00 -0000 1.6 @@ -2,29 +2,84 @@ WimpyPoint @context;noquote@ + + + + + + +
    +[ + +Last Week + + +Last Week + +| + +Last Two Weeks + + +Last Two Weeks + +| + +Last Month + + +Last Month + +| + +All + + +All + +] + +[ + +Yours +| +Everyone's + + +Yours +| +Everyone's + +] +
    +

    My Presentations

    +

    Options

    + + + +

    Everyone's Presentations

    +
    - -

    Options

    - \ No newline at end of file Index: openacs-4/packages/wp-slim/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/index.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/index.tcl 6 Sep 2002 15:32:23 -0000 1.4 +++ openacs-4/packages/wp-slim/www/index.tcl 28 Aug 2003 09:42:00 -0000 1.5 @@ -5,10 +5,13 @@ and give you some options...like creating a new presentation or editing an old one. - @author Paul Konigsberg (paul@arsdigita.com) + @author Rocael Hernandez (roc@viaro.net) openacs package owner + @author Paul Konigsberg (paul@arsdigita.com, original) @creation-date Wed Nov 8 17:33:21 2000 - @cvs-id $Id$ + @cvs-id index.tcl,v 1.4.2.1 2003/05/21 15:31:03 rocaelh Exp } { + {show_age:integer "14"} + {show_user "yours"} } set package_id [ad_conn package_id] @@ -17,47 +20,25 @@ set user_id [ad_verify_and_get_user_id] +set show_user_value "show_user=$show_user" +set show_age_value "show_age=$show_age" + +if {$show_age != 0} { + set extra_where_clauses [db_map extra_where_clauses] +} else { + set extra_where_clauses "" +} + if {$user_id == 0} { - db_multirow allpresentations get_all_public_presentations { - select i.item_id as pres_item_id, - pres.pres_title, - to_char(ao.creation_date, 'Month DD, YYYY') as creation_date, - ao.creation_user, - p.first_names || ' ' || p.last_name as full_name - from cr_items i, cr_wp_presentations pres, persons p, acs_objects ao - where i.live_revision = pres.presentation_id - and ao.object_id = i.item_id - and ao.creation_user = p.person_id - and pres.public_p = 't' - } + db_multirow allpresentations get_all_public_presentations { *SQL* } set return_url [ns_urlencode [ad_conn url]] ad_return_template index-unregistered } else { - db_multirow presentations get_my_presentations { - select i.item_id as pres_item_id, - p.pres_title, - to_char(ao.creation_date, 'Month DD, YYYY') as creation_date - from cr_items i, cr_wp_presentations p, acs_objects ao - where i.live_revision = p.presentation_id - and ao.object_id = i.item_id - and ao.creation_user = :user_id - } + db_multirow presentations get_my_presentations { *SQL* } - db_multirow allpresentations get_all_visible_presentations { - select i.item_id as pres_item_id, - pres.pres_title, - to_char(ao.creation_date, 'Month DD, YYYY') as creation_date, - ao.creation_user, - p.first_names || ' ' || p.last_name as full_name, - acs_permission.permission_p(i.item_id, :user_id, 'wp_edit_presentation') as edit_p - from cr_items i, cr_wp_presentations pres, persons p, acs_objects ao - where i.live_revision = pres.presentation_id - and ao.object_id = i.item_id - and ao.creation_user <> :user_id - and ao.creation_user = p.person_id - and acs_permission.permission_p(i.item_id, :user_id, -'wp_view_presentation') = 'f' + if {$show_user == "all"} { + db_multirow allpresentations get_all_visible_presentations { *SQL* } } ad_return_template index Index: openacs-4/packages/wp-slim/www/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/index.vuh,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/index.vuh 31 Oct 2001 20:42:07 -0000 1.2 +++ openacs-4/packages/wp-slim/www/index.vuh 28 Aug 2003 09:42:00 -0000 1.3 @@ -51,6 +51,11 @@ global ad_conn set ad_conn(file) "$file_path/get-binary-data.tcl" adp_parse_ad_conn_file +} elseif {[regexp {^styles/(default|[0-9]+)/(.*)} $url match style_id file_name]} { + # Serve a specific attachment + global ad_conn + set ad_conn(file) "$file_path/serve-style.tcl" + adp_parse_ad_conn_file } else { # Didn't understand the URL. ns_log notice "## Wimpy Point: Sorry I could not resolve the URL you requested: $url" Index: openacs-4/packages/wp-slim/www/presentation-acl-add-group-3-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-acl-add-group-3-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/presentation-acl-add-group-3-oracle.xql 4 Oct 2001 04:23:13 -0000 1.1 +++ openacs-4/packages/wp-slim/www/presentation-acl-add-group-3-oracle.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -3,35 +3,12 @@ oracle8.1.6 - + - - declare - cursor v_cursor is - select member_id - from group_member_map - where group_id = :group_id; - begin - if :role = 'read' then - for c in v_cursor loop - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_view_presentation'); - end loop; - elsif (:role = 'write') then - for c in v_cursor loop - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_view_presentation'); - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_edit_presentation'); - end loop; - else - for c in v_cursor loop - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_view_presentation'); - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_edit_presentation'); - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_admin_presentation'); - end loop; - end if; - end; - + begin + acs_permission.grant_permission(:pres_item_id, :member_id, :permission); + end; - Index: openacs-4/packages/wp-slim/www/presentation-acl-add-group-3-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-acl-add-group-3-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/presentation-acl-add-group-3-postgresql.xql 4 Oct 2001 04:23:13 -0000 1.1 +++ openacs-4/packages/wp-slim/www/presentation-acl-add-group-3-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -3,42 +3,12 @@ postgresql7.1 - + - - - select - if :role = ''read'' then - for record in select member_id - from group_member_map - where group_id = :group_id; - loop - acs_permission__grant_permission(:pres_item_id, c.member_id,''wp_view_presentation''); - end loop; - else if (:role = ''write'') then - for record in select member_id - from group_member_map - where group_id = :group_id; - loop - acs_permission__grant_permission(:pres_item_id, c.member_id, ''wp_view_presentation''); - acs_permission__grant_permission(:pres_item_id, c.member_id, -''wp_edit_presentation''); - end loop; - else - for record in select member_id - from group_member_map - where group_id = :group_id; - loop - acs_permission__grant_permission(:pres_item_id, c.member_id, -''wp_view_presentation''); - acs_permission__grant_permission(:pres_item_id, c.member_id, -''wp_edit_presentation''); - acs_permission__grant_permission(:pres_item_id, c.member_id, -''wp_admin_presentation''); - end loop; - end if; - - + begin + perform acs_permission__grant_permission(:pres_item_id, :member_id, :permission); + return 0; + end; Index: openacs-4/packages/wp-slim/www/presentation-acl-add-group-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-acl-add-group-3.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/presentation-acl-add-group-3.tcl 20 Apr 2001 20:51:24 -0000 1.1 +++ openacs-4/packages/wp-slim/www/presentation-acl-add-group-3.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -16,30 +16,15 @@ ad_require_permission $pres_item_id wp_admin_presentation # adds a group of users -db_exec_plsql group_add { - declare - cursor v_cursor is - select member_id - from group_member_map - where group_id = :group_id; - begin - if :role = 'read' then - for c in v_cursor loop - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_view_presentation'); - end loop; - elsif (:role = 'write') then - for c in v_cursor loop - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_view_presentation'); - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_edit_presentation'); - end loop; - else - for c in v_cursor loop - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_view_presentation'); - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_edit_presentation'); - acs_permission.grant_permission(:pres_item_id, c.member_id, 'wp_admin_presentation'); - end loop; - end if; - end; +db_foreach group_grant { *SQL } { + if {$role == "write"} { + set permission "wp_edit_presentation" + } elseif {$role == "admin"} { + set permission "wp_admin_presentation" + } else { + set permission "wp_view_presentation" + } + db_exec_plsql permission_grant { *SQL } } -ad_returnredirect presentation-acl?[export_url_vars pres_item_id] \ No newline at end of file +ad_returnredirect presentation-acl?[export_url_vars pres_item_id] Index: openacs-4/packages/wp-slim/www/presentation-acl-add-group-3.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-acl-add-group-3.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/presentation-acl-add-group-3.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,14 @@ + + + + postgresql7.1 + + + + select member_id + from group_member_map + where group_id = :group_id + + + + Index: openacs-4/packages/wp-slim/www/presentation-acl.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-acl.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/presentation-acl.tcl 6 Sep 2002 15:32:23 -0000 1.2 +++ openacs-4/packages/wp-slim/www/presentation-acl.tcl 28 Aug 2003 09:42:00 -0000 1.3 @@ -16,20 +16,10 @@ pres_item_id } -ad_require_permission $pres_item_id wp_admin_presentation +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_admin_presentation -set user_id [ad_maybe_redirect_for_registration] -#wp_check_authorization $pres_item_id $user_id "write" -#db_1row pres_select { -#select title, -# creation_user, -# public_p, -# group_id -#from wp_presentations -#where pres_item_id = :pres_item_id -#} - db_1row get_presentaiton { select p.pres_title as title, p.public_p, @@ -90,4 +80,4 @@ db_release_unused_handles -ad_return_template \ No newline at end of file +ad_return_template Index: openacs-4/packages/wp-slim/www/presentation-print-view-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-print-view-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/presentation-print-view-oracle.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,21 @@ + + + + oracle8.1.6 + + + + select s.slide_title as title , + i.item_id as slide_id , + s.sort_key,wp_slide.get_preamble(i.item_id) as preamble, + wp_slide.get_postamble(i.item_id) as postamble, + wp_slide.get_bullet_items(i.item_id) as bullet_list + from cr_wp_slides s, cr_items i + where i.parent_id = :pres_item_id + and i.live_revision = s.slide_id + order by s.sort_key + + + + + Index: openacs-4/packages/wp-slim/www/presentation-print-view-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-print-view-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/presentation-print-view-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,21 @@ + + + + postgresql7.1 + + + + select s.slide_title as title , + i.item_id as slide_id , + s.sort_key,wp_slide__get_preamble(i.item_id) as preamble, + wp_slide__get_postamble(i.item_id) as postamble, + wp_slide__get_bullet_items(i.item_id) as bullet_list + from cr_wp_slides s, cr_items i + where i.parent_id = :pres_item_id + and i.live_revision = s.slide_id + order by s.sort_key + + + + + Index: openacs-4/packages/wp-slim/www/presentation-print-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-print-view.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/presentation-print-view.adp 22 May 2003 15:18:55 -0000 1.2 +++ openacs-4/packages/wp-slim/www/presentation-print-view.adp 28 Aug 2003 09:42:00 -0000 1.3 @@ -1,5 +1,6 @@ @pres_title;noquote@ +@context;noquote@

    @pres_title@

    a Wimpy Point Presentation owned by @owner_name@ Index: openacs-4/packages/wp-slim/www/presentation-print-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-print-view.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/presentation-print-view.tcl 21 Sep 2002 17:09:10 -0000 1.1 +++ openacs-4/packages/wp-slim/www/presentation-print-view.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -2,7 +2,8 @@ ad_page_contract { This generates a printer friendly view of a presentation, suitable for print-out thru' a browser. @author Samir Joshi(samir@symphinity.com) - @creation-date Thu 8 Aug 2002 + @author Rocael HR (roc@viaro.net) + @creation-date Thu 1 Apr 2003 } { item_id:naturalnum,notnull @@ -18,7 +19,11 @@ owner_name:onevalue owner_id : onevalue } + +set context [list "Print View"] set user_id [ad_verify_and_get_user_id] +## permission checking roc@ +permission::require_permission -party_id $user_id -object_id $item_id -privilege wp_view_presentation set subsite_name [ad_conn package_url] regexp {^(.+)/$} $subsite_name match subsite_name Index: openacs-4/packages/wp-slim/www/presentation-print-view.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-print-view.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/presentation-print-view.xql 21 Sep 2002 17:09:10 -0000 1.1 +++ openacs-4/packages/wp-slim/www/presentation-print-view.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -51,18 +51,4 @@
    - - - select s.slide_title as title , - i.item_id as slide_id , - s.sort_key,wp_slide__get_preamble(i.item_id) as preamble, - wp_slide__get_postamble(i.item_id) as postamble, - wp_slide__get_bullet_items(i.item_id) as bullet_list - from cr_wp_slides s, cr_items i - where i.parent_id = :pres_item_id - and i.live_revision = s.slide_id - order by s.sort_key - - -
    Index: openacs-4/packages/wp-slim/www/presentation-revisions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-revisions.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/presentation-revisions.tcl 6 Sep 2002 15:32:23 -0000 1.3 +++ openacs-4/packages/wp-slim/www/presentation-revisions.tcl 28 Aug 2003 09:42:00 -0000 1.4 @@ -14,7 +14,12 @@ } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + + db_multirow revisions revisions_get { select r.revision_id, to_char(ao.creation_date, 'HH24:MI:SS Mon DD, YYYY') as creation_date, Index: openacs-4/packages/wp-slim/www/presentation-top-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-top-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/presentation-top-oracle.xql 4 Oct 2001 04:23:13 -0000 1.1 +++ openacs-4/packages/wp-slim/www/presentation-top-oracle.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -3,14 +3,16 @@ oracle8.1.6 - + select p.public_p, p.pres_title as presentation_title, acs_permission.permission_p(:pres_item_id, :user_id, 'wp_admin_presentation') as admin_p, acs_permission.permission_p(:pres_item_id, :user_id, 'wp_delete_presentation') as delete_p, - ao.creation_user + ao.creation_user, + p.show_comments_p, + p.presentation_id from cr_wp_presentations p, cr_items i, acs_objects ao @@ -21,19 +23,23 @@ - - + + - select first_names || ' ' || last_name as full_name, - person_id, - acs_permission.permission_p(:pres_item_id, person_id, 'wp_view_presentation') as view_p, - acs_permission.permission_p(:pres_item_id, person_id, 'wp_edit_presentation') as edit_p, - acs_permission.permission_p(:pres_item_id, person_id, 'wp_admin_presentation') as admin_p - from persons - where acs_permission.permission_p(:pres_item_id, person_id, 'wp_view_presentation') = 't' - or acs_permission.permission_p(:pres_item_id, person_id, 'wp_edit_presentation') = 't' - or acs_permission.permission_p(:pres_item_id, person_id, 'wp_admin_presentation') = 't' + select distinct (p.person_id), + p.first_names || ' ' || p.last_name as full_name, + perm.privilege + from persons p, + acs_permissions perm + where perm.object_id = :pres_item_id + and perm.grantee_id = p.person_id + and + (perm.privilege = 'wp_view_presentation' + or perm.privilege = 'wp_edit_presentation' + or perm.privilege = 'wp_admin_presentation' + ) + order by p.person_id, perm.privilege ASC Index: openacs-4/packages/wp-slim/www/presentation-top-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-top-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/presentation-top-postgresql.xql 17 May 2003 12:50:50 -0000 1.2 +++ openacs-4/packages/wp-slim/www/presentation-top-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.3 @@ -3,14 +3,16 @@ postgresql7.1 - + select p.public_p, p.pres_title as presentation_title, acs_permission__permission_p(:pres_item_id, :user_id, 'wp_admin_presentation') as admin_p, acs_permission__permission_p(:pres_item_id, :user_id, 'wp_delete_presentation') as delete_p, - ao.creation_user + ao.creation_user, + p.show_comments_p, + p.presentation_id from cr_wp_presentations p, cr_items i, acs_objects ao @@ -21,19 +23,23 @@ - - + + - select first_names || ' ' || last_name as full_name, - person_id, - acs_permission__permission_p(:pres_item_id, person_id, 'wp_view_presentation') as view_p, - acs_permission__permission_p(:pres_item_id, person_id, 'wp_edit_presentation') as edit_p, - acs_permission__permission_p(:pres_item_id, person_id, 'wp_admin_presentation') as admin_p - from persons - where acs_permission__permission_p(:pres_item_id, person_id, 'wp_view_presentation') = 't' - or acs_permission__permission_p(:pres_item_id, person_id, 'wp_edit_presentation') = 't' - or acs_permission__permission_p(:pres_item_id, person_id, 'wp_admin_presentation') = 't' + select distinct on (p.person_id) p.person_id, + p.first_names || ' ' || p.last_name as full_name, + perm.privilege + from persons p, + acs_permissions perm + where perm.object_id = :pres_item_id + and perm.grantee_id = p.person_id + and + (perm.privilege = 'wp_view_presentation' + or perm.privilege = 'wp_edit_presentation' + or perm.privilege = 'wp_admin_presentation' + ) + order by p.person_id, perm.privilege ASC Index: openacs-4/packages/wp-slim/www/presentation-top.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-top.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/presentation-top.adp 22 May 2003 15:18:55 -0000 1.5 +++ openacs-4/packages/wp-slim/www/presentation-top.adp 28 Aug 2003 09:42:00 -0000 1.6 @@ -3,7 +3,6 @@ @context;noquote@

    The Slides

    - Create the first slide. @@ -16,7 +15,7 @@
    [ edit | - delete | + delete | attach | view revisions] @@ -37,6 +36,7 @@

    Options

    Index: openacs-4/packages/wp-slim/www/presentation-top.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-top.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/presentation-top.tcl 6 Sep 2002 15:32:23 -0000 1.4 +++ openacs-4/packages/wp-slim/www/presentation-top.tcl 28 Aug 2003 09:42:00 -0000 1.5 @@ -22,22 +22,13 @@ } +#added permission checking roc@ set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation -db_1row get_presentaiton { -select p.public_p, - p.pres_title as presentation_title, - acs_permission.permission_p(:pres_item_id, :user_id, 'wp_admin_presentation') as admin_p, - acs_permission.permission_p(:pres_item_id, :user_id, 'wp_delete_presentation') as delete_p, - ao.creation_user -from cr_wp_presentations p, - cr_items i, - acs_objects ao -where i.item_id = :pres_item_id -and i.live_revision = p.presentation_id -and ao.object_id = :pres_item_id -} +db_1row get_presentation { *SQL* } + set encoded_title [ns_urlencode $presentation_title] set context [list "$presentation_title"] set subsite_name [ad_conn package_url] @@ -51,18 +42,17 @@ order by s.sort_key } -db_multirow viewers get_viewers { - select first_names || ' ' || last_name as full_name, - person_id, - acs_permission.permission_p(:pres_item_id, person_id, 'wp_view_presentation') as view_p, - acs_permission.permission_p(:pres_item_id, person_id, 'wp_edit_presentation') as edit_p, - acs_permission.permission_p(:pres_item_id, person_id, 'wp_admin_presentation') as admin_p - from persons - where acs_permission.permission_p(:pres_item_id, person_id, 'wp_view_presentation') = 't' - or acs_permission.permission_p(:pres_item_id, person_id, 'wp_edit_presentation') = 't' - or acs_permission.permission_p(:pres_item_id, person_id, 'wp_admin_presentation') = 't' +#lets not show duplicate users for this +#the oracle select distinct (p.person_id) doesn't work? so lets verify it in the db_multirow, in PG works fine =) roc@ +set users_list [list] +db_multirow users get_users {} { + if {[lsearch $users_list $person_id] != -1} { + continue + } + lappend users_list $person_id } + #set public_p [db_string get_permissions { #select decode(count(1),1,'The Public','') #from acs_permissions Index: openacs-4/packages/wp-slim/www/presentation-top.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/presentation-top.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/presentation-top.xql 4 Oct 2001 04:29:01 -0000 1.1 +++ openacs-4/packages/wp-slim/www/presentation-top.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -14,5 +14,5 @@ - + Index: openacs-4/packages/wp-slim/www/serve-presentation-revision-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-presentation-revision-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/serve-presentation-revision-oracle.xql 4 Oct 2001 04:23:13 -0000 1.1 +++ openacs-4/packages/wp-slim/www/serve-presentation-revision-oracle.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -12,7 +12,8 @@ p.public_p, p.show_modified_p, wp_presentation.get_audience_revision(:pres_revision_id) as audience, - wp_presentation.get_background_revision(:pres_revision_id) as background + wp_presentation.get_background_revision(:pres_revision_id) as background, + p.style from cr_wp_presentations p, cr_items i where i.item_id = :pres_item_id and p.presentation_id = :pres_revision_id Index: openacs-4/packages/wp-slim/www/serve-presentation-revision-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-presentation-revision-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/serve-presentation-revision-postgresql.xql 4 Oct 2001 04:23:13 -0000 1.1 +++ openacs-4/packages/wp-slim/www/serve-presentation-revision-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -10,7 +10,8 @@ p.page_signature, p.copyright_notice, p.public_p, - p.show_modified_p + p.show_modified_p, + p.style from cr_wp_presentations p, cr_items i where i.item_id = :pres_item_id and p.presentation_id = :pres_revision_id Index: openacs-4/packages/wp-slim/www/serve-presentation-revision.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-presentation-revision.adp,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/wp-slim/www/serve-presentation-revision.adp 22 May 2003 15:18:55 -0000 1.6 +++ openacs-4/packages/wp-slim/www/serve-presentation-revision.adp 28 Aug 2003 09:42:00 -0000 1.7 @@ -1,6 +1,9 @@ - + @pres_title;noquote@ @context;noquote@ +@style;noquote@ +@page_signature;noquote@ +@copyright_notice;noquote@

    One Revision

    @@ -30,7 +33,7 @@
    Show Modified Date? @show_modified_p@
    Audience @audience@
    -
    done | + done - next + | next

    @pres_title@

    a Wimpy Point Presentation owned by @owner_name@ + +
    in collaboration with + +@collaborators.full_name@ + + +
    +.
      @@ -22,6 +33,3 @@
    -

    Here is a printer-friendly version of the presentation. -
    -@page_signature@ Index: openacs-4/packages/wp-slim/www/serve-presentation.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-presentation.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/serve-presentation.tcl 21 Sep 2002 17:09:10 -0000 1.3 +++ openacs-4/packages/wp-slim/www/serve-presentation.tcl 28 Aug 2003 09:42:00 -0000 1.4 @@ -24,6 +24,9 @@ ad_return_error "Wimpy Point" "Could not get a pres_item_id and slide_item_id out of url=$url" } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_view_presentation set subsite_name [ad_conn package_url] regexp {^(.+)/$} $subsite_name match subsite_name @@ -37,12 +40,7 @@ and exists (select 1 from cr_wp_slides s where s.slide_id=cr_items.live_revision and s.sort_key=1) } -db_1row get_presentation_info { - select p.pres_title, p.page_signature - from cr_wp_presentations p, cr_items i - where i.item_id = :pres_item_id - and i.live_revision = p.presentation_id -} +db_1row get_presentation_info { *SQL* } db_1row get_owner_name { select first_names || ' ' || last_name as owner_name, person_id as owner_id @@ -59,4 +57,13 @@ order by s.sort_key " +set users_list [list] +db_multirow collaborators get_collaborators { *SQL* } { + if {[lsearch $users_list $person_id] != -1} { + continue + } + lappend users_list $person_id +} + + ad_return_template Index: openacs-4/packages/wp-slim/www/serve-presentation.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-presentation.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/serve-presentation.xql 4 Oct 2001 04:29:01 -0000 1.1 +++ openacs-4/packages/wp-slim/www/serve-presentation.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -17,7 +17,7 @@ - select p.pres_title, p.page_signature + select p.pres_title, p.page_signature, p.style, p.copyright_notice from cr_wp_presentations p, cr_items i where i.item_id = :pres_item_id and i.live_revision = p.presentation_id @@ -50,5 +50,26 @@ + + + + + select p.person_id, + p.first_names || ' ' || p.last_name as full_name, + perm.privilege + from persons p, + acs_permissions perm + where perm.object_id = :pres_item_id + and perm.grantee_id <> :owner_id + and perm.grantee_id = p.person_id + and + ( perm.privilege = 'wp_edit_presentation' + or perm.privilege = 'wp_admin_presentation' + ) + order by p.person_id, perm.privilege ASC + + + + Index: openacs-4/packages/wp-slim/www/serve-slide-revision.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-slide-revision.adp,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/serve-slide-revision.adp 22 May 2003 15:18:55 -0000 1.5 +++ openacs-4/packages/wp-slim/www/serve-slide-revision.adp 28 Aug 2003 09:42:00 -0000 1.6 @@ -1,6 +1,9 @@ - + @slide_title;noquote@ @context;noquote@ +@style;noquote@ +@page_signature;noquote@ +@copyright_notice;noquote@ Last modified @modified_date@ @@ -84,4 +87,4 @@ -@page_signature@ \ No newline at end of file +@page_signature@ Index: openacs-4/packages/wp-slim/www/serve-slide-revision.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-slide-revision.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/serve-slide-revision.tcl 6 Sep 2002 15:32:23 -0000 1.3 +++ openacs-4/packages/wp-slim/www/serve-slide-revision.tcl 28 Aug 2003 09:42:00 -0000 1.4 @@ -31,6 +31,9 @@ ad_return_error "Wimpy Point" "Could not get a pres_item_id, slide_item_id and slide_revision_id out of url=$url" } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_view_presentation set subsite_name [ad_conn package_url] regexp {^(.+)/$} $subsite_name match subsite_name Index: openacs-4/packages/wp-slim/www/serve-slide-revision.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-slide-revision.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/serve-slide-revision.xql 15 Nov 2001 01:47:13 -0000 1.2 +++ openacs-4/packages/wp-slim/www/serve-slide-revision.xql 28 Aug 2003 09:42:00 -0000 1.3 @@ -5,7 +5,9 @@ select p.page_signature, - p.show_modified_p + p.copyright_notice, + p.show_modified_p, + p.style from cr_wp_presentations p, cr_items i where i.item_id = :pres_item_id and i.live_revision = p.presentation_id Index: openacs-4/packages/wp-slim/www/serve-slide.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-slide.adp,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/wp-slim/www/serve-slide.adp 22 May 2003 15:18:55 -0000 1.8 +++ openacs-4/packages/wp-slim/www/serve-slide.adp 28 Aug 2003 09:42:00 -0000 1.9 @@ -1,6 +1,9 @@ @slide_title;noquote@ @context;noquote@ +@style;noquote@ +@page_signature;noquote@ +@copyright_notice;noquote@ @@ -94,3 +97,23 @@ @page_signature@ + + + +

    Slide Comments

    +@comments@ +
    + +
    + + + + + +
      +
    • +@comment_link@ +
    +
    + +
    Index: openacs-4/packages/wp-slim/www/serve-slide.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-slide.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/wp-slim/www/serve-slide.tcl 6 Sep 2002 15:32:23 -0000 1.5 +++ openacs-4/packages/wp-slim/www/serve-slide.tcl 28 Aug 2003 09:42:00 -0000 1.6 @@ -29,7 +29,19 @@ ad_return_error "Wimpy Point" "Could not get a pres_item_id and slide_item_id out of url=$url" } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_view_presentation +set edit_p 0 +if {[permission::permission_p -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation]} { + set edit_p 1 +} +set delete_p 0 +if {[permission::permission_p -party_id $user_id -object_id $pres_item_id -privilege wp_delete_presentation]} { + set delete_p 1 +} + set subsite_name [ad_conn package_url] regexp {^(.+)/$} $subsite_name match subsite_name #set pkg_key [ad_conn package_key] @@ -48,13 +60,7 @@ and ao.object_id = s.slide_id } -db_1row get_presentation_page_signature { - select p.page_signature, - p.show_modified_p - from cr_wp_presentations p, cr_items i - where i.item_id = :pres_item_id - and i.live_revision = p.presentation_id -} +db_1row get_presentation_page_signature { *SQL* } set context [list [list "$subsite_name/display/$pres_item_id" "one presentation"] "one slide"] @@ -90,10 +96,8 @@ if {$sort_key == 1} { # this is the only slide. set href_back "" - set href_forward "top" - } else { - set href_forward {} } + set href_forward "top" } else { set href_forward "next" } @@ -107,5 +111,22 @@ and i.live_revision = x.attach_id } -set href_back_forward "$href_back $href_forward" +set extra "" +if {$edit_p == 1} { + append extra "edit | " +} +if {$delete_p == 1} { + append extra "delete |" +} + +set href_back_forward "$href_back $extra $href_forward" + + +#comments capability added roc@ +if {$edit_p == 1 || $show_comments_p == "t"} { + set comment_link [general_comments_create_link $slide_item_id $url] + set comments [general_comments_get_comments -print_content_p 1 -print_attachments_p 1 \ + $slide_item_id $url] +} + ad_return_template serve-slide Index: openacs-4/packages/wp-slim/www/serve-slide.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-slide.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/serve-slide.xql 15 Nov 2001 01:47:13 -0000 1.2 +++ openacs-4/packages/wp-slim/www/serve-slide.xql 28 Aug 2003 09:42:00 -0000 1.3 @@ -5,7 +5,10 @@ select p.page_signature, - p.show_modified_p + p.copyright_notice, + p.show_modified_p, + p.style, + p.show_comments_p from cr_wp_presentations p, cr_items i where i.item_id = :pres_item_id and i.live_revision = p.presentation_id Index: openacs-4/packages/wp-slim/www/serve-style.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/serve-style.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/serve-style.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,29 @@ +# /packages/wp-slim/www/serve-style.tcl +ad_page_contract { + + # This file builds the respective CSS for a specific defined style. + @author Rocael HR (roc@viaro.net) +} { +} + +set url [ad_conn url] + +if {![regexp {styles/(default|[0-9]+)/(.*)} $url match style_id file_name]} { + ns_log notice "Could not get a style_id out of url=$url" + ad_abort_script +} + +if { $style_id == "default" } { + set style_id -1 +} + + +# Serve the top presentation page. +set css [db_string get_style { + select css + from wp_styles + where style_id = :style_id +}] + + +doc_return 200 "text/css" $css Index: openacs-4/packages/wp-slim/www/slide-publish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/slide-publish.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/wp-slim/www/slide-publish.tcl 20 Apr 2001 20:51:24 -0000 1.1 +++ openacs-4/packages/wp-slim/www/slide-publish.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -10,8 +10,13 @@ } { revision_id:naturalnum,notnull return_url:notnull + pres_item_id:notnull } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + db_exec_plsql live_revision_set { declare v_revision_id cr_revisions.revision_id%TYPE; @@ -35,4 +40,4 @@ end; } -ad_returnredirect $return_url \ No newline at end of file +ad_returnredirect $return_url Index: openacs-4/packages/wp-slim/www/slide-revisions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/slide-revisions.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/slide-revisions.adp 22 May 2003 15:18:55 -0000 1.4 +++ openacs-4/packages/wp-slim/www/slide-revisions.adp 28 Aug 2003 09:42:00 -0000 1.5 @@ -14,7 +14,7 @@ Created by @revisions.full_name@ from @revisions.creation_ip@ at @revisions.creation_date@ (view) -Created by @revisions.full_name@ from @revisions.creation_ip@ at @revisions.creation_date@ (view | go live) +Created by @revisions.full_name@ from @revisions.creation_ip@ at @revisions.creation_date@ (view | go live) Index: openacs-4/packages/wp-slim/www/slide-revisions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/slide-revisions.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/slide-revisions.tcl 6 Sep 2002 15:32:23 -0000 1.3 +++ openacs-4/packages/wp-slim/www/slide-revisions.tcl 28 Aug 2003 09:42:00 -0000 1.4 @@ -16,7 +16,11 @@ subsite_name } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + set subsite_name [ad_conn package_url] set context [list [list "presentation-top?[export_url_vars pres_item_id]" "Presentation"] "Slide Revisions"] Index: openacs-4/packages/wp-slim/www/slides-reorder-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/slides-reorder-2.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/wp-slim/www/slides-reorder-2.tcl 4 Oct 2001 04:29:01 -0000 1.2 +++ openacs-4/packages/wp-slim/www/slides-reorder-2.tcl 28 Aug 2003 09:42:00 -0000 1.3 @@ -12,6 +12,10 @@ } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + # Just iterate over the values for slide_id in order and set their respective # sort_keys to 1, 2, 3, ... set counter 0 Index: openacs-4/packages/wp-slim/www/slides-reorder.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/slides-reorder.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/slides-reorder.tcl 6 Sep 2002 15:32:23 -0000 1.3 +++ openacs-4/packages/wp-slim/www/slides-reorder.tcl 28 Aug 2003 09:42:00 -0000 1.4 @@ -14,6 +14,10 @@ } +#added permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_edit_presentation + set header [ad_header "Reorder Slides"] Index: openacs-4/packages/wp-slim/www/style-delete-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-delete-2-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-delete-2-oracle.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,17 @@ + + + + oracle8.1.6 + + + + + begin + wp_style.delete( p_style_id => :style_id ); + end; + + + + + + Index: openacs-4/packages/wp-slim/www/style-delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-delete-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-delete-2-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,15 @@ + + + + postgresql7.1 + + + + + select wp_style__delete(:style_id) + + + + + + Index: openacs-4/packages/wp-slim/www/style-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-delete-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-delete-2.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,23 @@ +# /wp-slim/www/style-delete-2.tcl + +ad_page_contract { + Description: Deletes the style. + + @param style_id is the ID of the style to delete + + @author Jon Salz (jsalz@mit.edu) + @author Rocael HR (roc@viaro.net) Ported & modified +} { + style_id:naturalnum,notnull +} + +set user_id [ad_verify_and_get_user_id] + +wp_check_style_authorization $style_id $user_id + +db_exec_plsql revisions_and_item_delete { *SQL* } + +db_release_unused_handles + +ad_returnredirect "style-list.tcl" + Index: openacs-4/packages/wp-slim/www/style-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-delete.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-delete.adp 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,14 @@ + +Delete @name@ +@context@ + +
    +@form_vars@ +Are you sure that you want to delete the style @name@ @images_str@? + +

    + + + +

    + Index: openacs-4/packages/wp-slim/www/style-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-delete.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,36 @@ +# /wp-slim/www/style-delete.tcl + +ad_page_contract { + Description: Confirms that the user wants to delete the style. + + @param style_id + + @creation-date 28 Nov 1999 + @author Jon Salz (jsalz@mit.edu) + @author Rocael HR (roc@viaro.net) Ported & modified +} { + style_id:naturalnum,notnull +} + + +set user_id [ad_verify_and_get_user_id] + +wp_check_style_authorization $style_id $user_id + +# Get the style information to display a confirmation message. +set name [db_string wp_style_name_select { *SQL* }] +set context [list "[list "style-list.tcl" "Your Styles"]" "Delete $name"] + +set num_images [db_string wp_image_count_select { *SQL* }] +if { $num_images == 0 } { + set images_str "" +} elseif { $num_images == 1 } { + set images_str "and the associated image" +} else { + set images_str ", including $num_images associated images" +} + + +set form_vars [export_form_vars style_id] + +ad_return_template Index: openacs-4/packages/wp-slim/www/style-delete.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-delete.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-delete.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,21 @@ + + + + + + + select name from wp_styles where style_id = :style_id + + + + + + + + + select count(*) from wp_style_images where style_id = :style_id + + + + + Index: openacs-4/packages/wp-slim/www/style-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-edit-2.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-edit-2.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,85 @@ + +# /wp-slim/www/style-edit-2.tcl +ad_page_contract { + Create or apply changes to a style. + @creation-date 28 Nov 1999 + @author Jon Salz + @author Rocael HR + @param name is the name of the style + @param style_id is the ID of the style (if editing) + @param presentation_id is the ID of the presentation to which the style is applied + @param text_color.* are rgb values of text_color + @param background_color.* are rgb values of background_color + @param link_color.* are rgb values of link_color + @param css is the text of a cascading style sheet (file) +} { + name:optional,notnull + style_id:integer,optional + presentation_id:naturalnum,optional + text_color.c1:naturalnum,optional + text_color.c2:naturalnum,optional + text_color.c3:naturalnum,optional + background_color.c1:naturalnum,optional + background_color.c2:naturalnum,optional + background_color.c3:naturalnum,optional + {background_image:integer "0"} + link_color.c1:naturalnum,optional + link_color.c2:naturalnum,optional + link_color.c3:naturalnum,optional + alink_color.c1:naturalnum,optional + alink_color.c2:naturalnum,optional + alink_color.c3:naturalnum,optional + vlink_color.c1:naturalnum,optional + vlink_color.c2:naturalnum,optional + vlink_color.c3:naturalnum,optional + public_p:notnull + css:optional +} + +# check for naughty html +if { [info exists name] && ![empty_string_p [ad_html_security_check $name]] } { + ad_return_complaint 1 "[ad_html_security_check $name]\n" + return +} +if { [info exists css] && ![empty_string_p [ad_html_security_check $css]] } { + ad_return_complaint 1 "[ad_html_security_check $css]\n" + return +} + +set user_id [ad_verify_and_get_user_id] + + +# We're OK to insert or update. + +if { [info exists style_id] } { + set condition "style_id = $style_id" + set query "update_style" + # If editing, make sure we can write to the style. + wp_check_style_authorization $style_id $user_id +} else { + set condition "" + set style_id [db_nextval "wp_style_seq"] + set query "insert_style" +} + +ad_process_color_widgets text_color background_color link_color alink_color vlink_color + + +db_transaction { + db_dml $query { *SQL* } + + if { [info exists presentation_id] } { + # We reached here through the "I'll upload my own" menu item in presentation-edit.tcl. + # Set the presentation's style, now that we've created it. + permission::require_permission -party_id $user_id -object_id $presentation_id -privilege wp_admin_presentation + + db_dml pres_update { *SQL* } + } +} on_error { + db_release_unused_handles + ad_return_error "Error" "Couldn't update your style." +} + +db_release_unused_handles + +ad_returnredirect "style-view?[export_url_vars style_id presentation_id]" Index: openacs-4/packages/wp-slim/www/style-edit-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-edit-2.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-edit-2.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,37 @@ + + + + + + + update wp_styles set name = :name, css = :css, text_color = :text_color, + background_color = :background_color, background_image = :background_image, + link_color = :link_color, alink_color = :alink_color, + vlink_color = :vlink_color, public_p = :public_p + where style_id = :style_id + + + + + + + + + insert into wp_styles + (style_id, name, css, text_color, background_color, background_image, + link_color, alink_color, vlink_color, public_p, owner) + values (:style_id, :name, :css, :text_color, :background_color, :background_image, + :link_color, :alink_color, :vlink_color, :public_p, :user_id) + + + + + + + + update cr_wp_presentations set style = :style_id where presentation_id = :presentation_id + + + + + Index: openacs-4/packages/wp-slim/www/style-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-edit.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-edit.adp 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,62 @@ + +@role@ Style +@context@ + + +
    +

    Create Style

    + +@export_form_vars@ + + + +

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name: 
    +A descriptive name, like @ramdom_name@. +
    Text Color: <%=[ad_color_widget text_color $text_color 1]%>
    Background Color: <%=[ad_color_widget background_color $background_color 1]%>
    Background Image: @background_images@
    Link Color: <%=[ad_color_widget link_color $link_color 1]%>
    Visited Link Color: <%=[ad_color_widget vlink_color $vlink_color 1]%>
    Active Link Color: <%=[ad_color_widget alink_color $alink_color 1]%>
    Available to other people? (Public): @public@

    CSS Source: 

    + +
    + +

    + Index: openacs-4/packages/wp-slim/www/style-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-edit.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-edit.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,85 @@ +# /wp-slim/www/style-edit.tcl +ad_page_contract { + Allows the user to create or edit a style. + @creation-date 28 Nov 1999 + @author Jon Salz + @author Rocael HR + @param style_id ID of the style to edit (if editing) + @param presentation_id ID of the presentation, if we should set a presentation to have this style +} { + style_id:naturalnum,optional + presentation_id:naturalnum,optional +} + +set user_id [ad_verify_and_get_user_id] + +set context {} + +if { [info exists style_id] } { + # Editing an existing style. Make sure we own it, and then retrieve info from the + # database. + wp_check_style_authorization $style_id $user_id + + db_1row style_select { *SQL* } + + + set header [list "style-view.tcl?style_id=$style_id" $name] + + set role "Edit" +} else { + # Creating a new style. Set fields to defaults. + set show_modified_p "f" + set public_p "t" + set style -1 + foreach var { name description header text_color background_color background_image link_color alink_color vlink_color css } { + set $var "" + } + + set role "Create" +} + +set colors { Chartreuse Mauve Teal Oyster Cordova Burgundy Spruce } +set elements { Polka-Dots Hearts {Maple Leaves} Peacocks Bunnies } + +if { [info exists style_id] } { + set items [db_list_of_lists wp_file_names_select { *SQL* } ] +} else { + set items "" +} + + +db_release_unused_handles + +if { $items == "" } { + set background_images "There are not yet any uploaded images to use as the background. + +" +} else { + set names [list] + set values [list] + foreach image $items { + lappend names [lindex $image 1] + lappend values [lindex $image 0] + } + + lappend names "none" + lappend values 0 + + set background_images "\n" +} + +set public "\n" + + +set values [list] + +set context "[list [list "style-list.tcl" "Your Styles"] $header "$role Style"]" + +set export_form_vars [export_form_vars style_id presentation_id] +set ad_color_widget_js [ad_color_widget_js] +set ramdom_name "[lindex $colors [randomRange [llength $colors]]] on [lindex $colors [randomRange [llength $colors]]] with [lindex $elements [randomRange [llength $elements]]]" + + +ad_return_template Index: openacs-4/packages/wp-slim/www/style-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-edit.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-edit.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,33 @@ + + + + + + + select name, + css, + text_color, + background_color, + background_image, + link_color, + alink_color, + vlink_color, + public_p + from wp_styles where style_id = :style_id + + + + + + + + + select wp_style_images_id, file_name + from wp_style_images + where style_id = :style_id + order by file_name + + + + + Index: openacs-4/packages/wp-slim/www/style-image-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-image-add.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-image-add.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,63 @@ +# /wp/style-image-add.tcl +ad_page_contract { + Add an image to a style. + + @param style_id id of the style to which to add + @param image the image to add + + @creation-date 28 Nov 1999 + @author Jon Salz + @author Rocael HR +} { + style_id:naturalnum,notnull + image:notnull + image.tmpfile:tmpfile,notnull +} + +set user_id [ad_maybe_redirect_for_registration] + +set tmp_filename ${image.tmpfile} + +set file_extension [string tolower [file extension $image]] +# remove the first . from the file extension +regsub {\.} $file_extension "" file_extension +set guessed_file_type [ns_guesstype $image] + +set n_bytes [file size $tmp_filename] +# strip off the C:\directories... crud and just get the file name +if ![regexp {([^/\\]+)$} $image match client_filename] { + set client_filename $image +} + + set mime_type [ns_guesstype $client_filename] + + + +db_transaction { + + set revision_id [cr_import_content -image_only -title $client_filename "" $tmp_filename $n_bytes $mime_type "${client_filename}${style_id}" ] + + + db_dml wp_style_img_insert { *SQL* } + + set background_image [db_string get_bg_image_id { *SQL* }] + + if {$background_image == 0} { + db_dml update_bg_image { *SQL* } + } + +} on_error { + # most likely a duplicate name, double click, or non-image file uploaded as an inline image. + + ad_return_complaint 1 "There was an error trying to add your image. Most likely causes you've +
    • Tried to upload a non-image file. +
    • Double-clicking the \"Save Image\" button on the previous page. +

    Here is the actual error message:

    $errmsg
    " + + ad_script_abort + +} + +db_release_unused_handles + +ad_returnredirect "style-view?style_id=$style_id" Index: openacs-4/packages/wp-slim/www/style-image-add.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-image-add.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-image-add.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,31 @@ + + + + + + + + insert into wp_style_images(style_id, file_size, file_name, wp_style_images_id) + values(:style_id, :n_bytes, :client_filename, :revision_id) + + + + + + + + select background_image from wp_styles where style_id = :style_id + + + + + + + + update wp_styles set background_image = :revision_id where style_id = :style_id + + + + + + Index: openacs-4/packages/wp-slim/www/style-image-delete-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-image-delete-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-image-delete-oracle.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,16 @@ + + + + oracle8.1.6 + + + + + begin + wp_style.image_delete( p_revision_id => :revision_id); + end; + + + + + Index: openacs-4/packages/wp-slim/www/style-image-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-image-delete-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-image-delete-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,14 @@ + + + + postgresql7.1 + + + + + select wp_style__image_delete(:revision_id) + + + + + Index: openacs-4/packages/wp-slim/www/style-image-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-image-delete.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-image-delete.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,26 @@ +# /wp-slim/www/style-image-delete.tcl + +ad_page_contract { + Deletes an image from a style. + + @param style_id the id of the style from which to delete the image + @param file_name file name of the image to delete + + @creation-date 28 Nov 1999 + @author Jon Salz + @cvs-id style-image-delete.tcl,v 3.2.2.5 2000/08/16 21:49:45 mbryzek Exp +} { + style_id:naturalnum,notnull + revision_id:notnull +} + +set user_id [ad_verify_and_get_user_id] + +#?? +#wp_check_style_authorization $style_id $user_id + +db_exec_plsql revisions_and_item_delete { *SQL* } + +db_release_unused_handles + +ad_returnredirect "style-view.tcl?style_id=$style_id" Index: openacs-4/packages/wp-slim/www/style-list-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-list-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-list-oracle.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,20 @@ + + + + oracle8.1.6 + + + + + select s.style_id, s.name, count(file_size) as images, sum(file_size) as total_size + from wp_styles s, wp_style_images i + where s.style_id = i.style_id(+) + and s.owner = :user_id + group by s.style_id, s.name + order by lower(s.name) + + + + + + Index: openacs-4/packages/wp-slim/www/style-list-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-list-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-list-postgresql.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,19 @@ + + + + + + + + select s.style_id, s.name, count(file_size) as images, sum(file_size) as total_size + from wp_styles s left join wp_style_images i on (s.style_id = i.style_id) + where + s.owner = :user_id + group by s.style_id, s.name + order by lower(s.name) + + + + + + Index: openacs-4/packages/wp-slim/www/style-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-list.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-list.adp 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,40 @@ + +Your Styles +@context@ + +

    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Style     # Images     Total Size     

    @styles_select.name@@styles_select.images@@styles_select.total_size@-[ delete ]
    You haven't created any styles.

    Create a new style
    +
    + +

    Index: openacs-4/packages/wp-slim/www/style-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-list.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-list.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,24 @@ +# wp-slim/style-list.tcl +ad_page_contract { + Shows all styles. + @param none + @creation-date 28 Nov 1999 + @author Jon Salz + @author Rocael HR +} { +} + +set user_id [ad_verify_and_get_user_id] + +set context {"your styles"} + + +db_multirow styles_select style_select_data { *SQL* } { + if {$total_size == ""} { set total_size 0 } + set total_size "[format "%.1f" [expr $total_size / 1024.0]]K" +} + +db_release_unused_handles + + +ad_return_template Index: openacs-4/packages/wp-slim/www/style-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-list.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-list.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,19 @@ + + + + + + + + select s.style_id, s.name, count(file_size) as images, sum(file_size) as total_size + from wp_styles s left join wp_style_images i on (s.style_id = i.style_id) + where + s.owner = :user_id + group by s.style_id, s.name + order by lower(s.name) + + + + + + Index: openacs-4/packages/wp-slim/www/style-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-view.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-view.adp 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,72 @@ + +One Style +@context@ + + + +@export_form_vars@ + +

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name: @name@

    Color Scheme: 
    + + +
    + @text_color_font@Plain Text@text_color_font_end@
    + @link_color_font@Linked Text@link_color_font_end@
    + @vlink_color_font@Linked Text (Visited)@alink_color_font_end@
    + @alink_color_font@Linked Text (Active)@vlink_color_font_end@ +
    +
    CSS Code: <%=[expr { [regexp {[^ \n\r\t]} $css] ? "view" : "none" }]%>


    Images: (none)
    + Images:  +
    @style_images.file_name@ @style_images.file_size@     delete
    +

    Add an image:
    +
    +

    +

    + +
    + +

    + Index: openacs-4/packages/wp-slim/www/style-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-view.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-view.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,63 @@ +# /wp/style-view.tcl +ad_page_contract { + Allows the user to view a style. + @creation-date 28 Nov 1999 + @author Jon Salz + @author Rocael HR + @param style_id (if editing) + @param presentation_id (if we were editing a presentation) +} { + style_id:integer,optional + presentation_id:naturalnum,optional +} + +set user_id [ad_verify_and_get_user_id] + +wp_check_style_authorization $style_id $user_id + +db_1row style_select { *SQL* } + +set url_vars "[export_url_vars style_id presentation_id]" + +if { $background_color == "" } { + set bgcolor_str "" +} else { + set bgcolor_str "bgcolor=[ad_color_to_hex $background_color]" +} +if { $background_image == "" } { + set bgimage_str "" +} else { + # this needs to be modified in order to handle the background images!! + set bgimage_str "style=\"background-image: url(view-image?revision_id=$background_image)\"" +} + +foreach property { text_color link_color alink_color vlink_color } { + if { [set $property] == "" } { + set "${property}_font" "" + set "${property}_font_end" "" + } else { + set "${property}_font" "" + set "${property}_font_end" "" + } +} + +# set the return link to the presentation we were editing, if id exists +if { [exists_and_not_null presentation_id] } { + set last_link " [list "presentation-top?pres_item_id=$presentation_id" "[db_string pres_name_select "select title from cr_wp_presentations where presentation_id = :presentation_id"]"]" +} else { +set last_link [list "style-list?user_id=$user_id" "Your Styles"] +} + +set context [list $last_link "One Style"] + +set export_form_vars "[export_form_vars style_id presentation_id]" + +db_multirow style_images style_image_select { *SQL* } { + + set file_size "[format "%.1f" [expr $file_size / 1024.0]]K" +} + +db_release_unused_handles + + +ad_return_template Index: openacs-4/packages/wp-slim/www/style-view.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/style-view.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/style-view.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,32 @@ + + + + + + + select name, + css, + text_color, + background_color, + background_image, + link_color, + alink_color, + vlink_color + from wp_styles where style_id = :style_id + + + + + + + + + select wp_style_images_id, file_size, file_name + from wp_style_images + where style_id = :style_id + order by file_name + + + + + Index: openacs-4/packages/wp-slim/www/toggle-comments-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/toggle-comments-view.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/toggle-comments-view.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,21 @@ +# /packages/wp/www/presentation-top.tcl + +ad_page_contract { + + Make comments on slides available or not to users. + + @author Rocael HR (roc@viaro.net) + @creation-date Thu Mar 31 17:11:10 2003 +} { + pres_item_id + presentation_id:integer,notnull + view:notnull +} + +#permission checking roc@ +set user_id [ad_verify_and_get_user_id] +permission::require_permission -party_id $user_id -object_id $pres_item_id -privilege wp_admin_presentation + +db_dml toggle_comments { *SQL* } + +ad_returnredirect "presentation-top?pres_item_id=$pres_item_id" Index: openacs-4/packages/wp-slim/www/toggle-comments-view.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/toggle-comments-view.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/toggle-comments-view.xql 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,12 @@ + + + + + + + update cr_wp_presentations set show_comments_p = :view where presentation_id = :presentation_id + + + + + Index: openacs-4/packages/wp-slim/www/upload-attachments.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/upload-attachments.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/upload-attachments.adp 22 May 2003 15:18:55 -0000 1.4 +++ openacs-4/packages/wp-slim/www/upload-attachments.adp 28 Aug 2003 09:42:00 -0000 1.5 @@ -9,19 +9,14 @@

    - - - - - Index: openacs-4/packages/wp-slim/www/users.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/users.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/wp-slim/www/users.adp 22 May 2003 15:18:55 -0000 1.4 +++ openacs-4/packages/wp-slim/www/users.adp 28 Aug 2003 09:42:00 -0000 1.5 @@ -9,4 +9,8 @@
  • @users.first_names@ @users.last_name@, @users.email@ (@users.num_presentations@) - +

    +Note: this is not a complete list of the users. +Users who are collaborators on +presentations owned by others are excluded. Users who have created +only private presentations are excluded. Index: openacs-4/packages/wp-slim/www/users.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/users.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/users.tcl 6 Sep 2002 15:32:23 -0000 1.3 +++ openacs-4/packages/wp-slim/www/users.tcl 28 Aug 2003 09:42:00 -0000 1.4 @@ -32,11 +32,6 @@ group by p.person_id, p.first_names, p.last_name, parties.email } -set footer "Note: this is not a complete list of the users. -Users who are collaborators on -presentations owned by others are excluded. Users who have created -only private presentations are excluded. -[ad_footer]" ad_return_template Index: openacs-4/packages/wp-slim/www/view-image.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/view-image.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/wp-slim/www/view-image.tcl 28 Aug 2003 09:42:00 -0000 1.2 @@ -0,0 +1,11 @@ +ad_page_contract { + + View an image. + +} { + + revision_id:integer,notnull + +} + +cr_write_content -revision_id $revision_id Index: openacs-4/packages/wp-slim/www/wp-presentation-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/wp-slim/www/wp-presentation-master.adp,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/wp-slim/www/wp-presentation-master.adp 22 May 2003 15:18:55 -0000 1.3 +++ openacs-4/packages/wp-slim/www/wp-presentation-master.adp 28 Aug 2003 09:42:00 -0000 1.4 @@ -1,16 +1,20 @@ +default@style_id@/style.css" type="text/css"> @title@ @header_stuff@ - @attribute.key@="@attribute.value@"> +> +
    +@copyright_notice@ +


    -
    @signatory@
    +
    @page_signature@
    @ds_link@ Index: openacs-4/www/blank-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/www/blank-master.adp 28 Aug 2003 09:49:50 -0000 1.2 @@ -0,0 +1,16 @@ +@doc_type;noquote@ + + +@title;noquote@ +@header_stuff;noquote@ + + + + + @attribute.key@="@attribute.value@"> + + + +@ds_link;noquote@ + + Index: openacs-4/www/blank-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/blank-master.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/www/blank-master.tcl 28 Aug 2003 09:49:50 -0000 1.2 @@ -0,0 +1,78 @@ +# /www/master-default.tcl +# +# Set basic attributes and provide the logical defaults for variables that +# aren't provided by the slave page. +# +# Author: Kevin Scaldeferri (kevin@arsdigita.com) +# Creation Date: 14 Sept 2000 +# $Id: blank-master.tcl,v 1.2 2003/08/28 09:49:50 lars Exp $ +# + +# fall back on defaults + +if { [template::util::is_nil doc_type] } { + set doc_type {} +} + +if { [template::util::is_nil title] } { + set title [ad_conn instance_name] +} + +if { ![info exists header_stuff] } { + set header_stuff {} +} + + +# Attributes + +template::multirow create attribute key value + +# Pull out the package_id of the subsite closest to our current node +set pkg_id [site_node_closest_ancestor_package "acs-subsite"] + +template::multirow append \ + attribute bgcolor [ad_parameter -package_id $pkg_id bgcolor dummy "white"] +template::multirow append \ + attribute text [ad_parameter -package_id $pkg_id textcolor dummy "black"] + +if { [info exists prefer_text_only_p] + && $prefer_text_only_p == "f" + && [ad_graphics_site_available_p] } { + template::multirow append attribute background \ + [ad_parameter -package_id $pkg_id background dummy "/graphics/bg.gif"] +} + +if { ![template::util::is_nil focus] } { + # Handle elements wohse name contains a dot + if { [regexp {^([^.]*)\.(.*)$} $focus match form_name element_name] } { + + # Add safety code to test that the element exists ' + set header_stuff "$header_stuff + + " + + template::multirow append \ + attribute onload "javascript:acs_focus('${form_name}', '${element_name}')" + } +} + +# Header links (stylesheets, javascript) +multirow create header_links rel type href media +multirow append header_links "stylesheet" "text/css" "/lists.css" "all" + + +# Developer-support: We include that here, so that master template authors don't have to worry about it + +if { [llength [namespace eval :: info procs ds_link]] == 1 } { + set ds_link "[ds_link]" +} else { + set ds_link "" +} Index: openacs-4/www/default-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/default-master.adp,v diff -u -N -r1.13 -r1.14 --- openacs-4/www/default-master.adp 26 Aug 2003 13:38:26 -0000 1.13 +++ openacs-4/www/default-master.adp 28 Aug 2003 09:49:50 -0000 1.14 @@ -1,10 +1,9 @@ -@doc_type;noquote@ - - -@title;noquote@ -@header_stuff;noquote@ - - @attribute.key@="@attribute.value@"> + + @title;noquote@ + @header_stuff;noquote@ + @focus;noquote@ + @doc_type;noquote@ + @@ -15,11 +14,8 @@ @context_bar;noquote@
    - +
    @signatory@
    -@ds_link;noquote@ - - Index: openacs-4/www/default-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/default-master.tcl,v diff -u -N -r1.13 -r1.14 --- openacs-4/www/default-master.tcl 26 Aug 2003 13:39:13 -0000 1.13 +++ openacs-4/www/default-master.tcl 28 Aug 2003 09:49:50 -0000 1.14 @@ -8,16 +8,12 @@ # $Id$ # -# fall back on defaults for title, signatory and header_stuff +# fall back on defaults if { [template::util::is_nil title] } { set title [ad_conn instance_name] } -if { [template::util::is_nil doc_type] } { - set doc_type {} -} - if { [template::util::is_nil signatory] } { set signatory [ad_system_owner] } @@ -30,11 +26,7 @@ set context_bar [ad_context_bar] } -if { ![info exists header_stuff] } { - set header_stuff {} -} - # Attributes template::multirow create attribute key value @@ -54,29 +46,6 @@ [ad_parameter -package_id $pkg_id background dummy "/graphics/bg.gif"] } -if { ![template::util::is_nil focus] } { - # Handle elements wohse name contains a dot - - if { [regexp {^([^.]*)\.(.*)$} $focus match form_name element_name] } { - # Add safety code to test that the element exists - set header_stuff "$header_stuff - - " - - template::multirow append \ - attribute onload "javascript:acs_focus('${form_name}', '${element_name}')" - } -} - - # Developer-support if { [llength [namespace eval :: info procs ds_link]] == 1 } { Index: openacs-4/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/Attic/index-oracle.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/www/index-oracle.xql 15 Apr 2003 10:32:08 -0000 1.4 +++ openacs-4/www/index-oracle.xql 28 Aug 2003 09:49:50 -0000 1.5 @@ -18,7 +18,7 @@ 'read') = 't' and apm_packages.package_id = site_nodes.object_id and apm_package_types.package_key = apm_packages.package_key - order by initial_install_p, name + order by initial_install_p, upper(name), name Index: openacs-4/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/Attic/index-postgresql.xql,v diff -u -N -r1.4 -r1.5 --- openacs-4/www/index-postgresql.xql 15 Apr 2003 10:32:08 -0000 1.4 +++ openacs-4/www/index-postgresql.xql 28 Aug 2003 09:49:50 -0000 1.5 @@ -18,7 +18,7 @@ 'read') = 't' and apm_packages.package_id = site_nodes.object_id and apm_package_types.package_key = apm_packages.package_key - order by initial_install_p, name + order by initial_install_p, upper(acs_object__name(object_id)) Index: openacs-4/www/lists.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/www/Attic/lists.css,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/www/lists.css 28 Aug 2003 09:49:50 -0000 1.2 @@ -0,0 +1,139 @@ +table.list { + font-family: tahoma, verdana, helvetica; + font-size: 85%; +} +table.list-tiny { + font-family: tahoma, verdana, helvetica; + font-size: 75%; +} + +p.list-row { + font-family: tahoma, verdana, helvetica; + font-size: 85%; +} + +span.list-label { + color: #6f6f6f; +} + + +tr.list-header { + background-color: #cccccc; +} +tr.list-subheader { + background-color: #bbbbbb; + font-weight: bold; +} +tr.list-even { + background-color: #f0f0f0; +} +tr.list-odd { + background-color: #e0e0e0; +} +tr.list-spacer { + background-color: #f9f9f9; +} + + +th.list { + padding-left: 16px; + padding-right: 16px; +} +th.list-narrow { + padding-left: 4px; + padding-right: 4px; +} + + +td.list { + padding-left: 16px; + padding-right: 16px; +} +td.list-narrow { + padding-left: 4px; + padding-right: 4px; +} + + + +tr.list-paginator { + background-color: #eeeeee; + font-size: 90%; } + + +tr.list-button-bar { + margin-bottom: 4px; + margin-top: 4px; + font-family: tahoma, verdana, helvetica; + background-color: #eeeeee; + font-size: 95%; +} +span.list-button-header { + border-width: 1px; + border-style: solid; + text-align: center; + border-color: #cccccc; + background-color: #ffffff; + padding: 1px; + padding-left: 12px; + padding-right: 12px; +} +span.list-button { + text-align: center; + border-color: #999999; + background-color: white; + padding: 1px; + padding-left: 4px; + padding-right: 4px; +} +a.list-button:link { + color: black; + text-decoration: none; +} +a.list-button:visited { + color: black; + text-decoration: none; +} +a.list-button:hover { + color: #666666; + text-decoration: none; +} + +.list-filter { + font-size: 70%; + font-family: tahoma,verdana,arial,helvetica; +} +tr.list-filter-selected { + background-color: #eeeeff; +} +span.list-filter-selected { + color: black; +} +.list-filter-header { + font-size: 70%; + font-family: tahoma,verdana,arial,helvetica; + font-weight: bold; +} +.list-filter-section { + font-size: 70%; + font-family: tahoma,verdana,arial,helvetica; + font-weight: bold; + background-color: #bbbbff; + padding-left: 4px; + padding-top: 4px; + padding-bottom: 4px; + margin-top: 0px; + margin-bottom: 8px; +} + +div.list-inline-filter { + font-size: 70%; + font-family: tahoma,verdana,arial,helvetica; +} +span.list-inline-filter { +} +span.list-inline-filter-selected { + font-weight: bold; +} +a.list-inline-filter { +}
  • File Name   File Size   Display

    There are @attachment_count@ -@attachment_count@ +@attachment_count@ attachments currently associated with this slide.