Index: openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-create.sql,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-create.sql 12 Feb 2002 00:02:13 -0000 1.7 +++ openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-create.sql 30 Nov 2002 17:32:08 -0000 1.8 @@ -57,7 +57,7 @@ -- the dynamic sql in acs_object__delete. so just use content_revision. v_content_type := ''content_revision''; - v_revision_id := acs_object__new(null, v_content_type); + v_revision_id := acs_object__new(null, v_content_type, now(), null, null, v_item_id); insert into cr_revisions (revision_id, item_id, title, publish_date, mime_type) @@ -124,13 +124,14 @@ end; ' language 'plpgsql'; -create function etp__create_new_revision(integer, varchar, integer) +create or replace function etp__create_new_revision(integer, varchar, integer) returns integer as ' declare p_package_id alias for $1; p_name alias for $2; p_user_id alias for $3; v_revision_id integer; + v_item_id integer; v_new_revision_id integer; v_content_type varchar; begin @@ -142,6 +143,11 @@ and i.parent_id = etp__get_folder_id(p_package_id) and r.item_id = i.item_id; + select item_id + into v_item_id + from cr_revisions + where revision_id = v_revision_id; + select object_type into v_content_type from acs_objects @@ -153,8 +159,8 @@ select acs_object_id_seq.nextval into v_new_revision_id from dual; - insert into acs_objects (object_id, object_type, creation_date, creation_user) - values (v_new_revision_id, v_content_type, now(), p_user_id); + insert into acs_objects (object_id, object_type, creation_date, creation_user, context_id) + values (v_new_revision_id, v_content_type, now(), p_user_id, v_item_id); insert into cr_revisions (revision_id, item_id, title, description, content, mime_type) select v_new_revision_id, item_id, title, description, content, mime_type Index: openacs-4/packages/edit-this-page/www/etp-trash.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/www/etp-trash.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/edit-this-page/www/etp-trash.xql 9 Nov 2001 03:38:17 -0000 1.3 +++ openacs-4/packages/edit-this-page/www/etp-trash.xql 30 Nov 2002 17:32:17 -0000 1.4 @@ -38,7 +38,7 @@ update cr_items - set parent_id = -400 + set parent_id = -400, live_revision = NULL where item_id = :item_id Index: openacs-4/packages/edit-this-page/www/etp.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/www/etp.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/edit-this-page/www/etp.tcl 4 Sep 2002 13:01:46 -0000 1.2 +++ openacs-4/packages/edit-this-page/www/etp.tcl 30 Nov 2002 17:32:17 -0000 1.3 @@ -20,6 +20,9 @@ etp::check_write_access +# lets make etp subsite aware +# get the cloest ancestor acs-subsite +set subsite_url [site_node_closest_ancestor_package_url -package_key "acs-subsite"] array set application_params [etp::get_application_params] set subtopic_object_name [etp::get_application_param index_object_name [ad_parameter subtopic_application "default"]] @@ -33,7 +36,9 @@ # the results aren't cached. set revision_id [etp::get_latest_revision_id $package_id $name] -db_1row get_current_page_attributes "" -column_array pa +if {![db_0or1row get_current_page_attributes "" -column_array pa]} { + ad_return_warning "Page $name does not exist" "No page by the name of $name exists" +} template::multirow create page_attributes name pretty_name value Index: openacs-4/packages/faq/faq.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/faq.info,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/faq/faq.info 17 Jul 2002 20:20:17 -0000 1.5 +++ openacs-4/packages/faq/faq.info 30 Nov 2002 17:32:33 -0000 1.6 @@ -7,15 +7,15 @@ f f - + oracle postgresql - Elizabeth Wirth Jennie Kim Housman + Elizabeth Wirth Port of FAQ module from 3.4 with a few enhancements. - 2001-03-15 + 2002-10-27 Ybos Corporation @@ -25,6 +25,7 @@ + @@ -40,7 +41,6 @@ - @@ -57,7 +57,6 @@ - Index: openacs-4/packages/faq/sql/oracle/faq-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/sql/oracle/faq-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/faq/sql/oracle/faq-create.sql 29 May 2002 23:05:24 -0000 1.2 +++ openacs-4/packages/faq/sql/oracle/faq-create.sql 30 Nov 2002 17:32:48 -0000 1.3 @@ -23,7 +23,8 @@ faq_name varchar (250) constraint faqs_faq_name_nn not null, - separate_p char(1) default 'f' check(separate_p in ('f','t')) + separate_p char(1) default 'f' check(separate_p in ('f','t')), + disabled_p char(1) default 'f' check(disabled_p in ('f','t')) ); Index: openacs-4/packages/faq/sql/oracle/upgrade/upgrade-4.0-4.6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/sql/oracle/upgrade/upgrade-4.0-4.6.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/faq/sql/oracle/upgrade/upgrade-4.0-4.6.sql 30 Nov 2002 17:33:06 -0000 1.2 @@ -0,0 +1,212 @@ +-- faq upgrade script +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2002-10-27 + +-- new procedure 'clone' + +create or replace package faq +as + + function new_faq ( + faq_id in faqs.faq_id%TYPE default null, + faq_name in faqs.faq_name%TYPE, + separate_p in faqs.separate_p%TYPE default 'f', + object_type in acs_objects.object_type%TYPE default 'faq', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return acs_objects.object_id%TYPE; + + + + procedure delete_faq ( + faq_id in faqs.faq_id%TYPE + ); + + + function new_q_and_a ( + entry_id in faq_q_and_as.entry_id%TYPE default null, + faq_id in faq_q_and_as.faq_id%TYPE, + question in faq_q_and_as.question%TYPE, + answer in faq_q_and_as.answer%TYPE, + sort_key in faq_q_and_as.sort_key%TYPE, + object_type in acs_objects.object_type%TYPE default 'faq_q_and_a', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return acs_objects.object_id%TYPE; + + + + procedure delete_q_and_a ( + entry_id in faq_q_and_as.entry_id%TYPE + ); + + + procedure clone ( + old_package_id in apm_packages.package_id%TYPE, + new_package_id in apm_packages.package_id%TYPE + ); + + +end faq; +/ +show errors + + + + +create or replace package body faq +as + function new_q_and_a ( + entry_id in faq_q_and_as.entry_id%TYPE default null, + faq_id in faq_q_and_as.faq_id%TYPE, + question in faq_q_and_as.question%TYPE, + answer in faq_q_and_as.answer%TYPE, + sort_key in faq_q_and_as.sort_key%TYPE, + object_type in acs_objects.object_type%TYPE default 'faq_q_and_a', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return acs_objects.object_id%TYPE + is + v_entry_id faq_q_and_as.entry_id%TYPE; + begin + v_entry_id := acs_object.new ( + object_id => entry_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); + insert into faq_q_and_as + (entry_id, faq_id, question, answer, sort_key) + values + (v_entry_id, new_q_and_a.faq_id, new_q_and_a.question, new_q_and_a.answer, new_q_and_a.sort_key); + + return v_entry_id; + end new_q_and_a; + + + + + procedure delete_q_and_a ( + entry_id in faq_q_and_as.entry_id%TYPE + ) + is + begin + delete from faq_q_and_as where entry_id = faq.delete_q_and_a.entry_id; + acs_object.delete(entry_id); + end delete_q_and_a; + + + + + function new_faq ( + faq_id in faqs.faq_id%TYPE default null, + faq_name in faqs.faq_name%TYPE, + separate_p in faqs.separate_p%TYPE default 'f', + object_type in acs_objects.object_type%TYPE default 'faq', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_user in acs_objects.creation_user%TYPE default null, + creation_ip in acs_objects.creation_ip%TYPE default null, + context_id in acs_objects.context_id%TYPE default null + ) return acs_objects.object_id%TYPE + is + v_faq_id faqs.faq_id%TYPE; + begin + + v_faq_id := acs_object.new ( + object_id => faq_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => context_id + ); + insert into faqs + (faq_id, faq_name,separate_p) + values + (v_faq_id, new_faq.faq_name,new_faq.separate_p); + + return v_faq_id; + end new_faq; + + + procedure delete_faq ( + faq_id faqs.faq_id%TYPE + ) + is + begin + + -- Because q_and_a's are objects, we need to + -- loop through a list of them, and call an explicit + -- delete function for each one. (i.e. each + -- entry_id) + + declare cursor q_and_a_cur is + select entry_id from faq_q_and_as where faq_id = faq.delete_faq.faq_id; + begin + for entry_list in q_and_a_cur + loop + delete_q_and_a(entry_list.entry_id); + end loop; + end; + + delete from faqs where faq_id=faq.delete_faq.faq_id; + acs_object.delete(faq_id); + + end delete_faq; + + + procedure clone ( + old_package_id in apm_packages.package_id%TYPE default null, + new_package_id in apm_packages.package_id%TYPE default null + ) + is + v_faq_id faqs.faq_id%TYPE; + v_entry_id faq_q_and_as.entry_id%TYPE; + begin + -- get all the faqs belonging to the old package, + -- and create new faqs for the new package + for one_faq in (select * + from acs_objects o, faqs f + where o.object_id = f.faq_id + and o.context_id = faq.clone.old_package_id) + loop + + -- faq is "scoped" by using the acs_objects.context_id + v_faq_id := faq.new_faq ( + faq_name => one_faq.faq_name, + separate_p => one_faq.separate_p, + context_id => faq.clone.new_package_id + ); + + for entry in (select * from faq_q_and_as f + where faq_id = one_faq.faq_id) + loop + -- now (surprise!) copy all the entries of this faq + v_entry_id := faq.new_q_and_a ( + context_id => entry.faq_id, + faq_id=> v_faq_id, + question => entry.question, + answer => entry.answer, + sort_key => entry.sort_key + ); + end loop; + end loop; + end clone; + + +end faq; +/ +show errors + + +-- disabled_p added to faqs + +alter table faqs add (disabled_p char(1) default 'f' check(disabled_p in ('f','t'))); Index: openacs-4/packages/faq/sql/postgresql/faq-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/sql/postgresql/faq-create.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/faq/sql/postgresql/faq-create.sql 17 Jul 2002 20:20:17 -0000 1.2 +++ openacs-4/packages/faq/sql/postgresql/faq-create.sql 30 Nov 2002 17:33:27 -0000 1.3 @@ -34,7 +34,8 @@ primary key, faq_name varchar (250) constraint faqs_faq_name_nn not null, - separate_p boolean check(separate_p in ('f','t')) + separate_p boolean check(separate_p in ('f','t')), + disabled_p char(1) default 'f' check(disabled_p in ('f','t')) ); Index: openacs-4/packages/file-manager/www/file-upload-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-manager/www/file-upload-2.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/file-manager/www/file-upload-2.tcl 18 Sep 2002 12:12:43 -0000 1.3 +++ openacs-4/packages/file-manager/www/file-upload-2.tcl 30 Nov 2002 17:33:45 -0000 1.4 @@ -23,10 +23,10 @@ } if {![empty_string_p $title] && [empty_string_p [file ext $title]]} { - incr errcnt - append errmsg " + ad_return_complaint "
  • The title you supply must have one of the following extensions:
    [ad_parameter Extensions file-manager]" + ad_script_abort } # Done with error checking Index: openacs-4/packages/file-storage/file-storage.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/file-storage.info,v diff -u -N -r1.17 -r1.18 --- openacs-4/packages/file-storage/file-storage.info 17 Sep 2002 21:03:22 -0000 1.17 +++ openacs-4/packages/file-storage/file-storage.info 30 Nov 2002 17:34:00 -0000 1.18 @@ -7,18 +7,18 @@ f f - + oracle postgresql Jowell S. Sabino This application allows users to collaboratively maintain documents on the web server - 2000-12-29 + 2002-10-27 OpenACS Now allows storage of files on the filesystem or database. - + @@ -32,6 +32,7 @@ + @@ -41,6 +42,7 @@ + @@ -120,8 +122,6 @@ - - @@ -152,11 +152,11 @@ - - - - + + + + Index: openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.2-4.6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.2-4.6.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/sql/oracle/upgrade/upgrade-4.2-4.6.sql 30 Nov 2002 17:34:09 -0000 1.2 @@ -0,0 +1,13 @@ +-- file-storage upgrade script +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2002-10-27 + +-- reload the packages and views +-- load the new fs-simple stuff + +@ ../file-storage-package-create.sql + +@ ../file-storage-simple-create.sql +@ ../file-storage-simple-package-create.sql + +@ ../file-storage-views-create.sql Index: openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.2-4.6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.2-4.6.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.2-4.6.sql 30 Nov 2002 17:34:18 -0000 1.2 @@ -0,0 +1,720 @@ +-- file-storage upgrade script +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2002-10-27 + +-- file-storage-package-create.sql +-- load the entire file, but use 'create or replace' to avoid +-- stomping on old functions + +create or replace function file_storage__get_root_folder ( + -- + -- Returns the root folder corresponding to a particular + -- package instance. + -- + integer -- apm_packages.package_id%TYPE +) +returns integer as ' -- fs_root_folders.folder_id%TYPE +declare + get_root_folder__package_id alias for $1; + 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 := file_storage__new_root_folder(get_root_folder__package_id, null, null); + end if; + + return v_folder_id; + +end;' language 'plpgsql' with (iscachable); + +create or replace function file_storage__get_package_id ( + integer -- cr_items.item_id%TYPE +) returns integer as ' -- fs_root_folders.package_id%TYPE +declare + get_package_id__item_id alias for $1; + v_package_id fs_root_folders.package_id%TYPE; + v_tree_sortkey cr_items.tree_sortkey%TYPE; +begin + + select fs_root_folders.package_id + into v_package_id + from fs_root_folders, + (select cr_items.item_id + from (select tree_ancestor_keys(cr_items_get_tree_sortkey(get_package_id__item_id)) as tree_sortkey) parents, + cr_items + where cr_items.tree_sortkey = parents.tree_sortkey) this + where fs_root_folders.folder_id = this.item_id; + + if NOT FOUND then + return null; + else + return v_package_id; + end if; + +end;' language 'plpgsql' with (iscachable); + +create or replace function file_storage__new_root_folder ( + -- + -- Creates a new root folder + -- + -- + -- A hackish function to get around the fact that we can not run + -- code automatically when a new package instance is created. + -- + integer, -- apm_packages.package_id%TYPE + varchar, -- cr_folders.label%TYPE + varchar -- cr_folders.description%TYPE +) +returns integer as ' -- fs_root_folders.folder_id%TYPE +declare + new_root_folder__package_id alias for $1; + new_root_folder__folder_name alias for $2; + new_root_folder__description alias for $3; + 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 := new_root_folder__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 := new_root_folder__description; + end if; + + v_folder_id := content_folder__new ( + v_package_key || ''_'' || new_root_folder__package_id, -- name + v_folder_name, -- label + v_description, -- description + null -- parent_id (default) + ); + + insert into fs_root_folders + (package_id, folder_id) + values + (new_root_folder__package_id, v_folder_id); + + -- allow child items to be added + -- JS: Note that we need to set include_subtypes to + -- JS: true since we created a new subtype. + PERFORM content_folder__register_content_type( + v_folder_id, -- folder_id + ''content_revision'', -- content_types + ''t'' -- include_subtypes + ); + PERFORM content_folder__register_content_type( + v_folder_id, -- folder_id + ''content_folder'', -- content_types + ''t'' -- include_subtypes + ); + + -- set up default permissions + PERFORM acs_permission__grant_permission ( + v_folder_id, -- object_id + acs__magic_object_id(''the_public''), -- grantee_id + ''read'' -- privilege + ); + + PERFORM acs_permission__grant_permission ( + v_folder_id, -- object_id + acs__magic_object_id(''registered_users''), -- grantee_id + ''write'' -- privilege + ); + + return v_folder_id; + +end;' language 'plpgsql'; + + +create or replace 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); + + return v_item_id; + +end;' language 'plpgsql'; + + +create or replace function file_storage__new_file( + 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? +) 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; +begin + + return file_storage__new_file( + new_file__title, + new_file__folder_id, + new_file__user_id, + new_file__creation_ip, + new_file__indb_p, + null + ); + +end;' language 'plpgsql'; + + +create or replace function file_storage__delete_file ( + -- + -- Delete a file and all its version + -- Wrapper to content_item__delete + -- + integer -- cr_items.item_id%TYPE +) returns integer as ' +declare + delete_file__file_id alias for $1; +begin + + return content_item__delete(delete_file__file_id); + +end;' language 'plpgsql'; + + +create or replace function file_storage__rename_file ( + -- + -- Rename a file and all + -- Wrapper to content_item__rename + -- + integer, -- cr_items.item_id%TYPE, + varchar -- cr_items.name%TYPE +) returns integer as ' +declare + rename_file__file_id alias for $1; + rename_file__title alias for $2; + +begin + + return content_item__rename( + rename_file__file_id, -- item_id + rename_file__title -- name + ); + +end;' language 'plpgsql'; + + +create or replace 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); + + return v_new_version_id; + +end;' language 'plpgsql'; + + +create or replace 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; +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); + + return 0; +end;' language 'plpgsql'; + + +create or replace function file_storage__get_title ( + -- + -- Unfortunately, title in the file-storage context refers + -- to the name attribute in cr_items, not the title attribute in + -- cr_revisions + integer -- cr_items.item_id%TYPE +) returns varchar as ' +declare + get_title__item_id alias for $1; + 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;' language 'plpgsql'; + +create or replace function file_storage__get_parent_id ( + integer -- item_id in cr_items.item_id%TYPE + ) returns integer as ' -- cr_items.item_id%TYPE + declare + get_parent_id__item_id alias for $1; + 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;'language 'plpgsql'; + + +create or replace function file_storage__get_content_type ( + -- + -- Wrapper for content_item__get_content_type + integer -- cr_items.item_id%TYPE +) returns varchar as ' -- cr_items.content_type%TYPE +declare + get_content_type__file_id alias for $1; +begin + return content_item__get_content_type( + get_content_type__file_id + ); + +end;' language 'plpgsql'; + + + +create or replace function file_storage__get_folder_name ( + -- + -- Wrapper for content_folder__get_label + integer -- cr_folders.folder_id%TYPE +) returns varchar as ' -- cr_folders.label%TYPE +declare + get_folder_name__folder_id alias for $1; +begin + return content_folder__get_label( + get_folder_name__folder_id + ); + +end;' language 'plpgsql'; + + +create or replace 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); + + return v_revision_id; + +end;' language 'plpgsql'; + + +create or replace function file_storage__delete_version ( + -- + -- Delete a version of a file + -- + integer, -- cr_items.item_id%TYPE, + integer -- cr_revisions.revision_id%TYPE +) returns integer as ' -- cr_items.parent_id%TYPE +declare + delete_version__file_id alias for $1; + delete_version__version_id alias for $2; + v_parent_id cr_items.parent_id%TYPE; + v_deleted_last_version_p boolean; +begin + + if delete_version__version_id = content_item__get_live_revision(delete_version__file_id) + then + PERFORM content_revision__delete(delete_version__version_id); + PERFORM content_item__set_live_revision( + content_item__get_latest_revision(delete_version__file_id) + ); + else + PERFORM content_revision__delete(delete_version__version_id); + end if; + + -- If the live revision is null, we have deleted the last version above + select (case when live_revision is null + then parent_id + else 0 + end) + into v_parent_id + from cr_items + where item_id = 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;' language 'plpgsql'; + + +create or replace function file_storage__new_folder( + -- + -- Create a folder + -- + varchar, -- cr_items.name%TYPE, + varchar, -- cr_folders.label%TYPE, + integer, -- cr_items.parent_id%TYPE, + integer, -- acs_objects.creation_user%TYPE, + varchar -- acs_objects.creation_ip%TYPE +) returns integer as ' -- cr_folders.folder_id%TYPE +declare + new_folder__name alias for $1; + new_folder__folder_name alias for $2; + new_folder__parent_id alias for $3; + new_folder__creation_user alias for $4; + new_folder__creation_ip alias for $5; + v_folder_id cr_folders.folder_id%TYPE; +begin + + -- Create a new folder + v_folder_id := content_folder__new ( + new_folder__name, -- name + new_folder__folder_name, -- label + null, -- description + new_folder__parent_id, -- parent_id + null, -- context_id (default) + null, -- folder_id (default) + now(), -- creation_date + new_folder__creation_user, -- creation_user + new_folder__creation_ip -- creation_ip + ); + + -- register the standard content types + -- JS: Note that we need to set include_subtypes + -- JS: to true since we created a new subtype. + PERFORM content_folder__register_content_type( + v_folder_id, -- folder_id + ''content_revision'', -- content_type + ''t''); -- include_subtypes (default) + + PERFORM content_folder__register_content_type( + v_folder_id, -- folder_id + ''content_folder'', -- content_type + ''t'' -- include_subtypes (default) + ); + + -- Give the creator admin privileges on the folder + PERFORM acs_permission__grant_permission ( + v_folder_id, -- object_id + new_folder__creation_user, -- grantee_id + ''admin'' -- privilege + ); + + return v_folder_id; + +end;' language 'plpgsql'; + + +create or replace function file_storage__delete_folder( + -- + -- Delete a folder + -- + integer -- cr_folders.folder_id%TYPE +) returns integer as ' -- 0 for success +declare + delete_folder__folder_id alias for $1; +begin + + return content_folder__delete( + delete_folder__folder_id -- folder_id + ); + +end;' language 'plpgsql'; + + +-- JS: BEFORE DELETE TRIGGER to clean up CR entries (except root folder) +create or replace function fs_package_items_delete_trig () returns opaque as ' +declare + + v_rec record; +begin + + for v_rec in + + -- We want to delete all cr_items entries, starting from the leaves all + -- the way up the root folder (old.folder_id). + select c1.item_id, c1.content_type + from cr_items c1, cr_items c2 + where c2.item_id = old.folder_id + and c1.tree_sortkey between c2.tree_sortkey and tree_right(c2.tree_sortkey) + and c1.item_id <> old.folder_id + order by c1.tree_sortkey desc + loop + + + -- We delete the item. On delete cascade should take care + -- of deletion of revisions. + if v_rec.content_type = ''file_storage_object'' + then + raise notice ''Deleting item_id = %'',v_rec.item_id; + PERFORM 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 + raise notice ''Deleting folder_id = %'',v_rec.item_id; + PERFORM content_folder__delete(v_rec.item_id); + end if; + + -- We may have to delete other items here, e.g., symlinks (future feature) + + end loop; + + -- We need to return something for the trigger to be activated + return old; + +end;' language 'plpgsql'; + +\i ../file-storage-simple-create.sql +\i ../file-storage-simple-package-create.sql + +drop view fs_folders; +drop view fs_files; +drop view fs_folders_and_files; + +\i ../file-storage-views-create.sql Index: openacs-4/packages/file-storage/www/folder-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-chunk.adp,v diff -u -N -r1.12 -r1.13 --- openacs-4/packages/file-storage/www/folder-chunk.adp 18 Nov 2002 18:01:05 -0000 1.12 +++ openacs-4/packages/file-storage/www/folder-chunk.adp 30 Nov 2002 17:34:29 -0000 1.13 @@ -10,10 +10,10 @@ - + - + #file-storage.folder# Index: openacs-4/packages/file-storage/www/folder-contents.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/folder-contents.adp,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/file-storage/www/folder-contents.adp 5 Nov 2002 17:19:59 -0000 1.4 +++ openacs-4/packages/file-storage/www/folder-contents.adp 30 Nov 2002 17:34:29 -0000 1.5 @@ -8,6 +8,7 @@
  • I#file-storage.Not_i##file-storage.lt_ncluding_items_from_s# + ( #file-storage.exclude# Index: openacs-4/packages/forums/forums.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/forums.info,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/forums/forums.info 23 Sep 2002 23:32:17 -0000 1.13 +++ openacs-4/packages/forums/forums.info 30 Nov 2002 17:34:39 -0000 1.14 @@ -7,7 +7,7 @@ f f - + oracle postgresql @@ -35,6 +35,7 @@ + @@ -49,11 +50,12 @@ + - - + + @@ -107,6 +109,8 @@ + + @@ -116,9 +120,9 @@ - - + + Index: openacs-4/packages/forums/sql/oracle/forums-forums-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-forums-create.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/forums/sql/oracle/forums-forums-create.sql 24 Jun 2002 22:37:52 -0000 1.3 +++ openacs-4/packages/forums/sql/oracle/forums-forums-create.sql 30 Nov 2002 17:34:49 -0000 1.4 @@ -68,7 +68,8 @@ check (enabled_p in ('t','f')), package_id integer constraint forums_package_id_nn - not null + not null, + last_post date ); create view forums_forums_enabled Index: openacs-4/packages/forums/sql/oracle/forums-forums-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-forums-package-create.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/forums/sql/oracle/forums-forums-package-create.sql 3 Jun 2002 23:58:45 -0000 1.3 +++ openacs-4/packages/forums/sql/oracle/forums-forums-package-create.sql 30 Nov 2002 17:34:49 -0000 1.4 @@ -73,8 +73,6 @@ values (v_forum_id, name, charter, presentation_type, posting_policy, package_id); - acs_object.update_last_modified(nvl(context_id, package_id)); - return v_forum_id; end new; Index: openacs-4/packages/forums/sql/oracle/forums-messages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-messages-create.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/forums/sql/oracle/forums-messages-create.sql 24 Jun 2002 22:37:52 -0000 1.3 +++ openacs-4/packages/forums/sql/oracle/forums-messages-create.sql 30 Nov 2002 17:34:49 -0000 1.4 @@ -50,6 +50,7 @@ check (open_p in ('t','f')), tree_sortkey raw(240), max_child_sortkey raw(100), + last_child_post date, constraint forums_mess_sk_forum_un unique (tree_sortkey, forum_id) ); Index: openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql 3 Jun 2002 23:58:45 -0000 1.3 +++ openacs-4/packages/forums/sql/oracle/forums-messages-package-create.sql 30 Nov 2002 17:34:49 -0000 1.4 @@ -80,9 +80,11 @@ ) return forums_messages.message_id%TYPE is v_message_id acs_objects.object_id%TYPE; + v_sortkey forums_messages.tree_sortkey%TYPE; v_forum_policy forums_forums.posting_policy%TYPE; v_state forums_messages.state%TYPE; begin + v_message_id := acs_object.new( object_id => message_id, object_type => object_type, @@ -113,8 +115,21 @@ values (v_message_id, forum_id, subject, content, html_p, user_id, posting_date, parent_id, v_state); - acs_object.update_last_modified(forum_id); + -- DRB: Can't use root_message_id() here because it triggers a "mutating table" error + select tree_sortkey into v_sortkey + from forums_messages + where message_id = v_message_id; + + update forums_forums + set last_post = posting_date + where forum_id = forums_message.new.forum_id; + + update forums_messages + set last_child_post = posting_date + where forum_id = forums_message.new.forum_id + and tree_sortkey = tree.ancestor_key(v_sortkey, 1); + return v_message_id; end new; Index: openacs-4/packages/forums/sql/oracle/upgrade-0.1d-0.2d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/Attic/upgrade-0.1d-0.2d.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/sql/oracle/upgrade-0.1d-0.2d.sql 30 Nov 2002 17:34:49 -0000 1.2 @@ -0,0 +1,328 @@ +alter table forums_forums add (last_post date); +alter table forums_messages add (last_child_post date); + +declare + v_date date; +begin + + for row in (select forum_id + from forums_forums) + loop + + select last_modified into v_date + from acs_objects + where object_id = row.forum_id; + + update forums_forums + set last_post = v_date + where forum_id = row.forum_id; + + end loop; + + for row in (select message_id + from forums_messages + where parent_id is null) + loop + + -- forums 0.1d did not properly set the last_modified field of the object + -- row associated with the root message of a thread, so we need to calculate + -- it here. + + select max(o.last_modified) into v_date + from acs_objects o, forums_messages fm + where forums_message.root_message_id(fm.message_id) = row.message_id + and object_id = fm.message_id; + + update forums_messages + set last_child_post = v_date + where message_id = row.message_id; + + end loop; + +end; +/ +show errors; + +drop view forums_messages_approved; +create view forums_messages_approved +as + select * + from forums_messages + where state = 'approved'; + +drop view forums_messages_pending; +create view forums_messages_pending +as + select * + from forums_messages + where state= 'pending'; + +drop view forums_forums_enabled; +create view forums_forums_enabled +as + select * + from forums_forums + where enabled_p = 't'; + +create or replace package body forums_message +as + + function new ( + message_id in forums_messages.message_id%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'forums_message', + forum_id in forums_messages.forum_id%TYPE, + subject in forums_messages.subject%TYPE, + content in varchar, + html_p in forums_messages.html_p%TYPE default 'f', + user_id in forums_messages.user_id%TYPE, + posting_date in forums_messages.posting_date%TYPE default sysdate, + state in forums_messages.state%TYPE default null, + parent_id in forums_messages.parent_id%TYPE 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 forums_messages.message_id%TYPE + is + v_message_id acs_objects.object_id%TYPE; + v_sortkey forums_messages.tree_sortkey%TYPE; + v_forum_policy forums_forums.posting_policy%TYPE; + v_state forums_messages.state%TYPE; + begin + + v_message_id := acs_object.new( + object_id => message_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => nvl(context_id, forum_id) + ); + + if state is null + then + select posting_policy + into v_forum_policy + from forums_forums + where forum_id= new.forum_id; + + if v_forum_policy = 'moderated' then + v_state := 'pending'; + else + v_state := 'approved'; + end if; + else + v_state := state; + end if; + + insert into forums_messages + (message_id, forum_id, subject, content, html_p, user_id, posting_date, parent_id, state) + values + (v_message_id, forum_id, subject, content, html_p, user_id, posting_date, parent_id, v_state); + + -- DRB: Can't use root_message_id() here because it triggers a "mutating table" error + + select tree_sortkey into v_sortkey + from forums_messages + where message_id = v_message_id; + + update forums_forums + set last_post = posting_date + where forum_id = forums_message.new.forum_id; + + update forums_messages + set last_child_post = posting_date + where forum_id = forums_message.new.forum_id + and tree_sortkey = tree.ancestor_key(v_sortkey, 1); + + return v_message_id; + end new; + + function root_message_id ( + message_id in forums_messages.message_id%TYPE + ) return forums_messages.message_id%TYPE + is + v_message_id forums_messages.message_id%TYPE; + v_forum_id forums_messages.forum_id%TYPE; + v_sortkey forums_messages.tree_sortkey%TYPE; + begin + select forum_id, tree_sortkey + into v_forum_id, v_sortkey + from forums_messages + where message_id = root_message_id.message_id; + + select message_id + into v_message_id + from forums_messages + where forum_id = v_forum_id + and tree_sortkey = tree.ancestor_key(v_sortkey, 1); + + return v_message_id; + end root_message_id; + + procedure thread_open ( + message_id in forums_messages.message_id%TYPE + ) + is + v_forum_id forums_messages.forum_id%TYPE; + v_sortkey forums_messages.tree_sortkey%TYPE; + begin + select forum_id, tree_sortkey + into v_forum_id, v_sortkey + from forums_messages + where message_id = thread_open.message_id; + + update forums_messages + set open_p = 't' + where tree_sortkey between tree.left(v_sortkey) and tree.right(v_sortkey) + and forum_id = v_forum_id; + + update forums_messages + set open_p = 't' + where message_id = thread_open.message_id; + end thread_open; + + procedure thread_close ( + message_id in forums_messages.message_id%TYPE + ) + is + v_forum_id forums_messages.forum_id%TYPE; + v_sortkey forums_messages.tree_sortkey%TYPE; + begin + select forum_id, tree_sortkey + into v_forum_id, v_sortkey + from forums_messages + where message_id = thread_close.message_id; + + update forums_messages + set open_p = 'f' + where tree_sortkey between tree.left(v_sortkey) and tree.right(v_sortkey) + and forum_id = v_forum_id; + + update forums_messages + set open_p = 'f' + where message_id = thread_close.message_id; + end thread_close; + + procedure delete ( + message_id in forums_messages.message_id%TYPE + ) + is + begin + acs_object.delete(message_id); + end delete; + + procedure delete_thread ( + message_id in forums_messages.message_id%TYPE + ) + is + v_forum_id forums_messages.forum_id%TYPE; + v_sortkey forums_messages.tree_sortkey%TYPE; + v_message forums_messages%ROWTYPE; + begin + select forum_id, tree_sortkey + into v_forum_id, v_sortkey + from forums_messages + where message_id = delete_thread.message_id; + + -- if it's already deleted + if SQL%NOTFOUND then + return; + end if; + + -- delete all children + -- order by tree_sortkey desc to guarantee + -- that we never delete a parent before its child + -- sortkeys are beautiful + for v_message in (select * + from forums_messages + where forum_id = v_forum_id + and tree_sortkey between tree.left(v_sortkey) and tree.right(v_sortkey) + order by tree_sortkey desc) + loop + forums_message.delete(v_message.message_id); + end loop; + + -- delete the message itself + forums_message.delete(delete_thread.message_id); + end delete_thread; + + function name ( + message_id in forums_messages.message_id%TYPE + ) return varchar + is + v_name forums_messages.subject%TYPE; + begin + select subject + into v_name + from forums_messages + where message_id = forums_message.name.message_id; + + return v_name; + end name; + +end forums_message; +/ +show errors + +create or replace package body forums_forum +as + + function new ( + forum_id in forums_forums.forum_id%TYPE default null, + object_type in acs_objects.object_type%TYPE default 'forums_forum', + name in forums_forums.name%TYPE, + charter in forums_forums.charter%TYPE default null, + presentation_type in forums_forums.presentation_type%TYPE, + posting_policy in forums_forums.posting_policy%TYPE, + package_id in forums_forums.package_id%TYPE, + 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 forums_forums.forum_id%TYPE + is + v_forum_id forums_forums.forum_id%TYPE; + begin + v_forum_id := acs_object.new( + object_id => forum_id, + object_type => object_type, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip, + context_id => nvl(context_id, package_id) + ); + + insert into forums_forums + (forum_id, name, charter, presentation_type, posting_policy, package_id) + values + (v_forum_id, name, charter, presentation_type, posting_policy, package_id); + + return v_forum_id; + end new; + + function name ( + forum_id in forums_forums.forum_id%TYPE + ) return varchar + is + v_name forums_forums.name%TYPE; + begin + select name + into v_name + from forums_forums + where forum_id = name.forum_id; + + return v_name; + end name; + + procedure delete ( + forum_id in forums_forums.forum_id%TYPE + ) + is + begin + acs_object.delete(forum_id); + end delete; + +end forums_forum; +/ +show errors Index: openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql 10 Jul 2002 18:30:36 -0000 1.4 +++ openacs-4/packages/forums/sql/postgresql/forums-forums-create.sql 30 Nov 2002 17:35:03 -0000 1.5 @@ -22,11 +22,6 @@ select acs_privilege__create_privilege('forum_post',null,null); select acs_privilege__create_privilege('forum_moderate',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; - -- add children select acs_privilege__add_child('create','forum_create'); select acs_privilege__add_child('write','forum_write'); @@ -37,13 +32,6 @@ select acs_privilege__add_child('forum_write','forum_read'); select acs_privilege__add_child('forum_write','forum_post'); - -- 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 (); - -- the last one that will cause all the updates select acs_privilege__add_child('read','forum_read'); @@ -81,7 +69,8 @@ check (enabled_p in ('t','f')), package_id integer constraint forums_package_id_nn - not null + not null, + last_post timestamp ); create view forums_forums_enabled Index: openacs-4/packages/forums/sql/postgresql/forums-forums-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-forums-package-create.sql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/forums/sql/postgresql/forums-forums-package-create.sql 5 Aug 2002 20:00:08 -0000 1.6 +++ openacs-4/packages/forums/sql/postgresql/forums-forums-package-create.sql 30 Nov 2002 17:35:03 -0000 1.7 @@ -43,8 +43,6 @@ values (v_forum_id, p_name, p_charter, p_presentation_type, p_posting_policy, p_package_id); - perform acs_object__update_last_modified(coalesce(p_context_id, p_package_id)); - return v_forum_id; end; ' language 'plpgsql'; Index: openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 24 Jun 2002 22:37:52 -0000 1.5 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-create.sql 30 Nov 2002 17:35:03 -0000 1.6 @@ -50,6 +50,7 @@ check (open_p in ('t','f')), tree_sortkey varbit, max_child_sortkey varbit, + last_child_post timestamp, constraint forums_mess_sk_forum_un unique (tree_sortkey, forum_id) ); Index: openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 20 Aug 2002 21:39:42 -0000 1.8 +++ openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql 30 Nov 2002 17:35:03 -0000 1.9 @@ -69,9 +69,16 @@ values (v_message_id, p_forum_id, p_subject, p_content, p_html_p, p_user_id, v_posting_date, p_parent_id, v_state); - perform acs_object__update_last_modified(p_forum_id); + update forums_forums + set last_post = v_posting_date + where forum_id = p_forum_id; + update forums_messages + set last_child_post = v_posting_date + where message_id = forums_message__root_message_id(v_message_id); + return v_message_id; + end; ' language 'plpgsql'; Index: openacs-4/packages/forums/sql/postgresql/upgrade-0.1d-0.2d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/Attic/upgrade-0.1d-0.2d.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/sql/postgresql/upgrade-0.1d-0.2d.sql 30 Nov 2002 17:35:03 -0000 1.2 @@ -0,0 +1,173 @@ +alter table forums_forums add column last_post timestamp; +alter table forums_messages add column last_child_post timestamp; + +create or replace function t () returns integer as ' +declare + v_record record; + v_timestamp timestamp; +begin + + for v_record in select forum_id + from forums_forums + loop + + select last_modified into v_timestamp + from acs_objects + where object_id = v_record.forum_id; + + update forums_forums + set last_post = v_timestamp + where forum_id = v_record.forum_id; + + end loop; + + for v_record in select message_id + from forums_messages + where parent_id is null + loop + + -- forums 0.1d did not properly set the last_modified field of the object + -- row associated with the root message of a thread, so we need to calculate + -- it here. + + select max(o.last_modified) into v_timestamp + from acs_objects o, forums_messages fm + where forums_message__root_message_id(fm.message_id) = v_record.message_id + and object_id = fm.message_id; + + update forums_messages + set last_child_post = v_timestamp + where message_id = v_record.message_id; + + end loop; + + return 1; + +end;' language 'plpgsql'; + +select t(); + +drop view forums_messages_approved; +create view forums_messages_approved +as + select * + from forums_messages + where state = 'approved'; + +drop view forums_messages_pending; +create view forums_messages_pending +as + select * + from forums_messages + where state= 'pending'; + +drop view forums_forums_enabled; +create view forums_forums_enabled +as + select * + from forums_forums + where enabled_p = 't'; + +create or replace function forums_message__new (integer,varchar,integer,varchar,text,char,integer,timestamp,varchar,integer,timestamp,integer,varchar,integer) +returns integer as ' +declare + p_message_id alias for $1; + p_object_type alias for $2; + p_forum_id alias for $3; + p_subject alias for $4; + p_content alias for $5; + p_html_p alias for $6; + p_user_id alias for $7; + p_posting_date alias for $8; + p_state alias for $9; + p_parent_id alias for $10; + p_creation_date alias for $11; + p_creation_user alias for $12; + p_creation_ip alias for $13; + p_context_id alias for $14; + v_message_id integer; + v_forum_policy forums_forums.posting_policy%TYPE; + v_state forums_messages.state%TYPE; + v_posting_date forums_messages.posting_date%TYPE; +begin + v_message_id := acs_object__new( + p_message_id, + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_forum_id) + ); + + if p_state is null then + select posting_policy + into v_forum_policy + from forums_forums + where forum_id = p_forum_id; + + if v_forum_policy = ''moderated'' + then v_state := ''pending''; + else v_state := ''approved''; + end if; + else + v_state := p_state; + end if; + + if p_posting_date is null then + v_posting_date = now(); + else + v_posting_date = p_posting_date; + end if; + + insert into forums_messages + (message_id, forum_id, subject, content, html_p, user_id, posting_date, parent_id, state) + values + (v_message_id, p_forum_id, p_subject, p_content, p_html_p, p_user_id, v_posting_date, p_parent_id, v_state); + + update forums_forums + set last_post = v_posting_date + where forum_id = p_forum_id; + + update forums_messages + set last_child_post = v_posting_date + where message_id = forums_message__root_message_id(v_message_id); + + return v_message_id; + +end; +' language 'plpgsql'; + +create or replace function forums_forum__new (integer,varchar,varchar,varchar,varchar,varchar,integer,timestamp,integer,varchar,integer) +returns integer as ' +declare + p_forum_id alias for $1; + p_object_type alias for $2; + p_name alias for $3; + p_charter alias for $4; + p_presentation_type alias for $5; + p_posting_policy alias for $6; + p_package_id alias for $7; + p_creation_date alias for $8; + p_creation_user alias for $9; + p_creation_ip alias for $10; + p_context_id alias for $11; + v_forum_id integer; +begin + v_forum_id:= acs_object__new( + p_forum_id, + p_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + coalesce(p_context_id, p_package_id) + ); + + insert into forums_forums + (forum_id, name, charter, presentation_type, posting_policy, package_id) + values + (v_forum_id, p_name, p_charter, p_presentation_type, p_posting_policy, p_package_id); + + return v_forum_id; +end; +' language 'plpgsql'; + Index: openacs-4/packages/forums/tcl/forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/forums/tcl/forums-procs.tcl 25 Oct 2002 13:00:01 -0000 1.8 +++ openacs-4/packages/forums/tcl/forums-procs.tcl 30 Nov 2002 17:35:17 -0000 1.9 @@ -66,6 +66,26 @@ db_1row select_forum {} -column_array row } + ad_proc -public posting_policy_set { + {-posting_policy:required} + {-forum_id:required} + } { + # JCD: this is potentially bad since we are + # just assuming registered_users is the + # right group to be granting forum_write to. + + if {![string equal closed $posting_policy]} { + permission::grant -object_id $forum_id \ + -party_id [acs_magic_object registered_users] \ + -privilege forum_write + } else { + permission::revoke -object_id $forum_id \ + -party_id [acs_magic_object registered_users] \ + -privilege forum_write + } + + } + ad_proc -public new_questions_allow { {-forum_id:required} } { Index: openacs-4/packages/forums/tcl/forums-security-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-security-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/forums/tcl/forums-security-procs.tcl 25 Oct 2002 13:00:01 -0000 1.4 +++ openacs-4/packages/forums/tcl/forums-security-procs.tcl 30 Nov 2002 17:35:17 -0000 1.5 @@ -13,8 +13,12 @@ ad_proc -private do_abort {} { do an abort if security violation } { - ad_returnredirect "not-allowed" - return -code error + if { [ad_conn user_id] == 0 } { + ad_redirect_for_registration + } else { + ad_returnredirect "not-allowed" + } + ad_script_abort } ad_proc -public can_read_forum_p { Index: openacs-4/packages/forums/tcl/messages-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/messages-procs.tcl,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/forums/tcl/messages-procs.tcl 18 Nov 2002 18:01:07 -0000 1.13 +++ openacs-4/packages/forums/tcl/messages-procs.tcl 30 Nov 2002 17:35:17 -0000 1.14 @@ -77,7 +77,6 @@ append new_content "Forum: $message(forum_name)
    \n" append new_content "Thread: $message(root_subject)
    \n" append new_content "Author: $message(user_name)
    \n" - append new_content "Posted: $message(posting_date)
    " append new_content "\n
    \n" append new_content $message(content) append new_content "

    -------------------
    " @@ -87,25 +86,24 @@ set html_version $new_content set text_version "" - append text_version " -Forum: $message(forum_name) -Thread: $message(root_message_id) -Author: $message(user_name) ($message(user_email)) -Posted: $message(posting_date) ----------------------------------- -[ad_html_to_text $message(content)] ---------------------------------- -To post a reply to this email or view this message go to: -${url}message-view?message_id=$message(root_message_id) + + append text_version "Forum: $message(forum_name) +Thread: $message(root_subject) +Author: $message(user_name) ($message(user_email))\n\n" -To view Forum $message(forum_name) go to: -${url}forum-view?forum_id=$message(forum_id) -To email the author($message(user_name)) privately: -mailto:$message(user_email) + if { $message(html_p) } { + append text_version [ad_html_to_text $message(content)] + } else { + append text_version [wrap_string $message(content)] + } + append text_version "\n\n-- +To post a reply to this email or view this message go to: +${url}message-view?message_id=$message(root_message_id) " + set new_content $text_version - ns_log notice "requesting a notification with subject $message(forum_name) $message(subject)" + ns_log debug "forums: requesting a notification forum $message(forum_name) subject $message(subject)" # Do the notification for the forum Index: openacs-4/packages/forums/www/forum-view-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/forum-view-oracle.xql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/forums/www/forum-view-oracle.xql 18 Nov 2002 18:01:08 -0000 1.6 +++ openacs-4/packages/forums/www/forum-view-oracle.xql 30 Nov 2002 17:35:39 -0000 1.7 @@ -14,13 +14,11 @@ from forums_messages_approved fm1 where fm1.forum_id = :forum_id and fm1.tree_sortkey between tree.left(fm.tree_sortkey) and tree.right(fm.tree_sortkey)) as n_messages, - to_char(acs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - case when acs_objects.last_modified > (sysdate - 1) then 't' else 'f' end as new_p - from forums_messages_approved fm, - acs_objects + to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi, + case when fm.last_child_post > (sysdate - 1) then 't' else 'f' end as new_p + from forums_messages_approved fm where fm.forum_id = :forum_id and fm.parent_id is null - and fm.message_id = acs_objects.object_id order by fm.posting_date desc @@ -37,13 +35,11 @@ from forums_messages fm1 where fm1.forum_id = :forum_id and fm1.tree_sortkey between tree.left(fm.tree_sortkey) and tree.right(fm.tree_sortkey)) as n_messages, - to_char(acs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - case when acs_objects.last_modified > (sysdate - 1) then 't' else 'f' end as new_p - from forums_messages fm, - acs_objects + to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi, + case when fm.last_child_post > (sysdate - 1) then 't' else 'f' end as new_p + from forums_messages fm where fm.forum_id = :forum_id and fm.parent_id is null - and fm.message_id = acs_objects.object_id order by fm.posting_date desc Index: openacs-4/packages/forums/www/forum-view-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/forum-view-postgresql.xql,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/forums/www/forum-view-postgresql.xql 18 Nov 2002 18:01:08 -0000 1.5 +++ openacs-4/packages/forums/www/forum-view-postgresql.xql 30 Nov 2002 17:35:39 -0000 1.6 @@ -14,13 +14,11 @@ from forums_messages_approved fm1 where fm1.forum_id = :forum_id and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages, - to_char(acs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - case when acs_objects.last_modified > (now() - 1) then 't' else 'f' end as new_p - from forums_messages_approved fm, - acs_objects + to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi, + case when fm.last_child_post > (now() - 1) then 't' else 'f' end as new_p + from forums_messages_approved fm where fm.forum_id = :forum_id and fm.parent_id is null - and fm.message_id = acs_objects.object_id order by fm.posting_date desc @@ -37,13 +35,11 @@ from forums_messages fm1 where fm1.forum_id = :forum_id and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages, - to_char(acs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - case when acs_objects.last_modified > (now() - 1) then 't' else 'f' end as new_p - from forums_messages fm, - acs_objects + to_char(fm.last_child_post, 'YYYY-MM-DD HH24:MI:SS') as last_child_post_ansi, + case when fm.last_child_post > (now() - 1) then 't' else 'f' end as new_p + from forums_messages_approved fm where fm.forum_id = :forum_id and fm.parent_id is null - and fm.message_id = acs_objects.object_id order by fm.posting_date desc 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.16 -r1.17 --- openacs-4/packages/forums/www/forum-view.adp 18 Nov 2002 18:01:08 -0000 1.16 +++ openacs-4/packages/forums/www/forum-view.adp 30 Nov 2002 17:35:39 -0000 1.17 @@ -70,7 +70,7 @@ @messages.user_name@ @messages.n_messages@ - @messages.last_modified_pretty@ + @messages.last_child_post_pretty@ Index: openacs-4/packages/forums/www/forum-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/forum-view.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/forums/www/forum-view.tcl 18 Nov 2002 18:01:08 -0000 1.10 +++ openacs-4/packages/forums/www/forum-view.tcl 30 Nov 2002 17:35:39 -0000 1.11 @@ -66,8 +66,8 @@ set query messages_select_moderator } -db_multirow -extend { last_modified_pretty } messages $query {} { - set last_modified_pretty [lc_time_fmt $last_modified_ansi "%x %X"] +db_multirow -extend { last_post_pretty } messages $query {} { + set last_post_pretty [lc_time_fmt $last_post_ansi "%x %X"] } set notification_chunk [notification::display::request_widget \ Index: openacs-4/packages/forums/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/index-oracle.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/forums/www/index-oracle.xql 18 Nov 2002 18:01:08 -0000 1.3 +++ openacs-4/packages/forums/www/index-oracle.xql 30 Nov 2002 17:35:39 -0000 1.4 @@ -10,17 +10,15 @@ from forums_messages where forums_messages.forum_id = forums_forums_enabled.forum_id and 1 = tree.tree_level(forums_messages.tree_sortkey)) as n_threads, - to_char(acs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - case when last_modified > (sysdate - 1) then 't' else 'f' end as new_p - from forums_forums_enabled, - acs_objects + to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, + case when last_post > (sysdate - 1) then 't' else 'f' end as new_p + from forums_forums_enabled where forums_forums_enabled.package_id = :package_id and ( forums_forums_enabled.posting_policy = 'open' or forums_forums_enabled.posting_policy = 'moderated' - or 't' = acs_permission.permission_p(:user_id, forums_forums_enabled.forum_id, 'forum_read') + or 't' = acs_permission.permission_p(forums_forums_enabled.forum_id, :user_id, 'forum_read') ) - and forums_forums_enabled.forum_id = acs_objects.object_id order by forums_forums_enabled.name Index: openacs-4/packages/forums/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/index-postgresql.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/forums/www/index-postgresql.xql 18 Nov 2002 18:01:08 -0000 1.3 +++ openacs-4/packages/forums/www/index-postgresql.xql 30 Nov 2002 17:35:39 -0000 1.4 @@ -10,17 +10,15 @@ from forums_messages where forums_messages.forum_id = forums_forums_enabled.forum_id and 1 = tree_level(forums_messages.tree_sortkey)) as n_threads, - to_char(acs_objects.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified_ansi, - case when last_modified > (now() - 1) then 't' else 'f' end as new_p - from forums_forums_enabled, - acs_objects + to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, + case when last_post > (now() - 1) then 't' else 'f' end as new_p + from forums_forums_enabled where forums_forums_enabled.package_id = :package_id and ( forums_forums_enabled.posting_policy = 'open' or forums_forums_enabled.posting_policy = 'moderated' - or 't' = acs_permission__permission_p(:user_id, forums_forums_enabled.forum_id, 'forum_read') + or 't' = acs_permission__permission_p(forums_forums_enabled.forum_id, :user_id,'forum_read') ) - and forums_forums_enabled.forum_id = acs_objects.object_id order by forums_forums_enabled.name 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.15 -r1.16 --- openacs-4/packages/forums/www/index.adp 18 Nov 2002 18:01:08 -0000 1.15 +++ openacs-4/packages/forums/www/index.adp 30 Nov 2002 17:35:39 -0000 1.16 @@ -60,8 +60,8 @@ - @forums.last_modified_pretty@ - + @forums.last_post_pretty@ +   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.13 -r1.14 --- openacs-4/packages/forums/www/message-chunk.adp 18 Nov 2002 18:01:08 -0000 1.13 +++ openacs-4/packages/forums/www/message-chunk.adp 30 Nov 2002 17:35:39 -0000 1.14 @@ -1,16 +1,17 @@ + - - - - @message.subject@ - - - @message.subject@ - - - + + + @message.subject@ + + + @message.subject@ + + + + @message.user_name@ @message.posting_date_pretty@ Index: openacs-4/packages/forums/www/message-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/message-chunk.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/forums/www/message-chunk.tcl 25 Oct 2002 13:00:02 -0000 1.5 +++ openacs-4/packages/forums/www/message-chunk.tcl 30 Nov 2002 17:35:39 -0000 1.6 @@ -24,5 +24,10 @@ if {![exists_and_not_null moderate_p]} { set moderate_p 0 } if {![exists_and_not_null forum_moderated_p]} {set forum_moderated_p 0} - - +# JCD: display subject only if changed from the root subject +if {![info exists root_subject]} { + set display_subject_p 1 +} else { + regsub {^(Response to |\s*Re:\s*)*} $message(subject) {} subject + set display_subject_p [expr ![string equal $subject $root_subject]] +} 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.5 -r1.6 --- openacs-4/packages/forums/www/message-email.tcl 25 Oct 2002 13:00:02 -0000 1.5 +++ openacs-4/packages/forums/www/message-email.tcl 30 Nov 2002 17:35:39 -0000 1.6 @@ -65,6 +65,8 @@ element set_properties message subject -value "\[[_ forums.Fwd] $message(subject)\]" element set_properties message message_id -value $message_id +set message(subject) [ad_quotehtml $message(subject)] + set context [list [list "./forum-view?forum_id=$message(forum_id)" "$message(forum_name)"]] if {![empty_string_p $message(parent_id)]} { lappend context [list "./message-view?message_id=$message(root_message_id)" "[_ forums.Entire_Thread]"] Index: openacs-4/packages/forums/www/message-post.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-post.tcl,v diff -u -N -r1.17 -r1.18 --- openacs-4/packages/forums/www/message-post.tcl 18 Nov 2002 18:01:08 -0000 1.17 +++ openacs-4/packages/forums/www/message-post.tcl 30 Nov 2002 17:35:39 -0000 1.18 @@ -9,6 +9,7 @@ } -query { {forum_id ""} {parent_id ""} + {html_p "f"} } -validate { forum_id_or_parent_id { if {[empty_string_p $forum_id] && [empty_string_p $parent_id]} { @@ -53,7 +54,7 @@ element create message html_p \ -label [_ forums.Format] \ -datatype text \ - -widget select \ + -widget radio \ -options [list [list [_ forums.text] f] [list [_ forums.html] t]] element create message parent_id \ @@ -100,7 +101,7 @@ set exported_vars [export_form_vars message_id forum_id parent_id subject content html_p confirm_p] set message(html_p) $html_p - set message(subject) $subject + set message(subject) [ad_quotehtml $subject] set message(content) $content set message(user_id) $user_id set message(user_name) [db_string select_name {}] @@ -177,7 +178,10 @@ forum::message::get -message_id $parent_id -array parent_message set forum_id $parent_message(forum_id) set subject "[_ forums.Re] $parent_message(subject)" + set parent_message(subject) [ad_quotehtml $parent_message(subject)] + # trim multiple leading Re: + regsub {^(\s*Re:\s*)*} $subject {Re: } subject } forum::security::require_post_forum -forum_id $forum_id 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.7 -r1.8 --- openacs-4/packages/forums/www/message-view-flat.adp 25 Oct 2002 13:00:02 -0000 1.7 +++ openacs-4/packages/forums/www/message-view-flat.adp 30 Nov 2002 17:35:39 -0000 1.8 @@ -31,10 +31,10 @@ - + - + Index: openacs-4/packages/forums/www/message-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view.tcl,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/forums/www/message-view.tcl 18 Nov 2002 18:01:08 -0000 1.13 +++ openacs-4/packages/forums/www/message-view.tcl 30 Nov 2002 17:35:39 -0000 1.14 @@ -27,6 +27,7 @@ # Load up the message information forum::message::get -message_id $message_id -array message +set message(subject) [ad_quotehtml $message(subject)] form create search -action search @@ -88,10 +89,12 @@ set order_by "tree_sortkey" } -db_multirow -extend { posting_date_pretty } responses $query {} { +db_multirow -extend { posting_date_pretty } responses $query {} { + set subject [ad_quotehtml $subject] set posting_date_pretty [lc_time_fmt $posting_date_ansi "%x %X"] } + # If this is a top-level thread, we allow subscriptions here if {[empty_string_p $message(parent_id)]} { set notification_chunk [notification::display::request_widget \ Index: openacs-4/packages/forums/www/not-allowed.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/not-allowed.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/www/not-allowed.adp 30 Nov 2002 17:35:39 -0000 1.2 @@ -0,0 +1,5 @@ + +Action Not Allowed +@context@ + +We're sorry, but it appears that you do not have the permission to perform this operation. \ No newline at end of file Index: openacs-4/packages/forums/www/not-allowed.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/not-allowed.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/www/not-allowed.tcl 30 Nov 2002 17:35:39 -0000 1.2 @@ -0,0 +1,10 @@ +ad_page_contract { + + Action not allowed. + + @author Lars Pind (lars@pinds.com) + @creation-date 2002-10-14 + @cvs-id $Id: not-allowed.tcl,v 1.2 2002/11/30 17:35:39 jeffd Exp $ +} + +set context [list "Not Allowed"] Index: openacs-4/packages/forums/www/admin/forum-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/forum-edit.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/forums/www/admin/forum-edit.tcl 11 Nov 2002 19:23:17 -0000 1.10 +++ openacs-4/packages/forums/www/admin/forum-edit.tcl 30 Nov 2002 17:35:58 -0000 1.11 @@ -16,8 +16,7 @@ -label [_ forums.Forum_ID] -datatype integer -widget hidden element create forum name \ - -label [_ forums.Name] -datatype text -widget text -html {size 60} -validate { {expr ![empty_string_p [string trim $value]]} {Forum Name can not be blank} - } + -label [_ forums.Name] -datatype text -widget text -html {size 60} -validate { {expr ![empty_string_p [string trim $value]]} {Forum Name can not be blank} } element create forum charter \ -label [_ forums.Charter] -datatype text -widget textarea -html {cols 60 rows 10 wrap soft} -optional @@ -39,6 +38,9 @@ -charter $charter \ -presentation_type $presentation_type \ -posting_policy $posting_policy + + forum::posting_policy_set -posting_policy $posting_policy \ + -forum_id $forum_id # Users can create new threads? if {$new_threads_p} { Index: openacs-4/packages/forums/www/admin/forum-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/admin/forum-new.tcl,v diff -u -N -r1.10 -r1.11 --- openacs-4/packages/forums/www/admin/forum-new.tcl 25 Oct 2002 13:00:03 -0000 1.10 +++ openacs-4/packages/forums/www/admin/forum-new.tcl 30 Nov 2002 17:35:58 -0000 1.11 @@ -65,6 +65,9 @@ -package_id $package_id \ ] + forum::posting_policy_set -posting_policy $posting_policy \ + -forum_id $forum_id + # Users can create new threads? if {$new_threads_p} { forum::new_questions_allow -forum_id $forum_id Index: openacs-4/packages/forums/www/moderate/message-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/message-delete.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/forums/www/moderate/message-delete.tcl 18 Nov 2002 18:01:09 -0000 1.7 +++ openacs-4/packages/forums/www/moderate/message-delete.tcl 30 Nov 2002 17:36:14 -0000 1.8 @@ -19,6 +19,7 @@ # Select the stuff forum::message::get -message_id $message_id -array message +set message(subject) [ad_quotehtml $message(subject)] # Confirmed? if {$confirm_p} { Index: openacs-4/packages/forums/www/moderate/message-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/moderate/message-edit.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/forums/www/moderate/message-edit.tcl 25 Oct 2002 13:00:04 -0000 1.4 +++ openacs-4/packages/forums/www/moderate/message-edit.tcl 30 Nov 2002 17:36:14 -0000 1.5 @@ -22,13 +22,19 @@ -label [_ forums.Subject] \ -datatype text \ -widget text \ - -html {size 60} + -html {size 60} \ + -validate { {expr ![empty_string_p [string trim $value]]} {Please enter a subject} } element create message content \ -label [_ forums.Body] \ -datatype text \ -widget textarea \ - -html {rows 20 cols 60 wrap soft} + -html {rows 20 cols 60 wrap soft} \ + -validate { + empty {expr ![empty_string_p [string trim $value]]} {Please enter a message} + html { expr {( [string match [set l_html_p [ns_queryget html_p f]] "t"] && [empty_string_p [set v_message [ad_html_security_check $value]]] ) || [string match $l_html_p "f"] } } + {} + } element create message html_p \ -label [_ forums.Format]2 \ @@ -58,6 +64,7 @@ element set_properties message content -value $message(content) element set_properties message html_p -value $message(html_p) +set message(subject) [ad_quotehtml $message(subject)] ad_return_template 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.6 -r1.7 --- openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 7 Nov 2002 08:32:48 -0000 1.6 +++ openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 30 Nov 2002 17:36:30 -0000 1.7 @@ -43,7 +43,7 @@ } else { set content_select [db_map content_select] ;# ", r.content" } - ns_log notice "content_select: $content_select" + # ns_log notice "content_select: $content_select" set html "" db_foreach get_comments " Index: openacs-4/packages/glossary/www/glossary-add-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/glossary/www/glossary-add-edit.adp,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/glossary/www/glossary-add-edit.adp 5 Sep 2002 10:20:04 -0000 1.2 +++ openacs-4/packages/glossary/www/glossary-add-edit.adp 30 Nov 2002 17:36:40 -0000 1.3 @@ -33,7 +33,7 @@

    -Worflow Policy: +Workflow Policy: Not defined, Please set 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.9 -r1.10 --- openacs-4/packages/lars-blogger/lars-blogger.info 30 Sep 2002 21:20:49 -0000 1.9 +++ openacs-4/packages/lars-blogger/lars-blogger.info 30 Nov 2002 17:36:49 -0000 1.10 @@ -35,17 +35,21 @@ + + + + @@ -57,14 +61,11 @@ - + - - - @@ -73,18 +74,14 @@ - - - - - - + + @@ -99,6 +96,7 @@ + @@ -109,7 +107,7 @@ - + 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.2 -r1.3 --- openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql 14 Sep 2002 21:43:34 -0000 1.2 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-create.sql 30 Nov 2002 17:36:59 -0000 1.3 @@ -11,12 +11,12 @@ 'Blog Entry', -- pretty_name 'Blog Entries', -- pretty_plural 'acs_object', -- supertype - 'PINDS_BLOG_ENTRIES', -- table_name - 'ENTRY_ID', -- id_column + 'pinds_blog_entries', -- table_name + 'entry_id', -- id_column null, -- package_name 'f', -- abstract_p null, -- type_extension_table - 'PINDS_BLOG_ENTRY__TITLE' -- name_method + 'pinds_blog_entry__title' -- name_method ); create table pinds_blog_entries ( Index: openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-sc-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-sc-create.sql 30 Nov 2002 17:36:59 -0000 1.2 @@ -0,0 +1,69 @@ +-- This is a lars blogger implementation of the FtsContentProvider +-- service contract + +select acs_sc_impl__new( + 'FtsContentProvider', -- impl_contract_name + 'pinds_blog_entry', -- impl_name + 'lars-blogger' -- impl_owner_name +); + +select acs_sc_impl_alias__new( + 'FtsContentProvider', -- impl_contract_name + 'pinds_blog_entry', -- impl_name + 'datasource', -- impl_operation_name + 'pinds_blog_entry__datasource', -- impl_alias + 'TCL' -- impl_pl +); + +select acs_sc_impl_alias__new( + 'FtsContentProvider', -- impl_contract_name + 'pinds_blog_entry', -- impl_name + 'url', -- impl_operation_name + 'pinds_blog_entry__url', -- impl_alias + 'TCL' -- impl_pl +); + + +create function pinds_blog_entries__itrg () +returns opaque as ' +begin + if new.draft_p = ''f'' then + perform search_observer__enqueue(new.entry_id,''INSERT''); + end if; + return new; +end;' language 'plpgsql'; + +create function pinds_blog_entries__dtrg () +returns opaque as ' +begin + perform search_observer__enqueue(old.entry_id,''DELETE''); + return old; +end;' language 'plpgsql'; + +create function pinds_blog_entries__utrg () +returns opaque as ' +begin + if (new.draft_p = ''f'' and old.draft_p = ''t'') or new.deleted_p = ''t'' then + perform search_observer__enqueue(old.entry_id,''DELETE''); + else + perform search_observer__enqueue(old.entry_id,''UPDATE''); + end if; + return old; +end;' language 'plpgsql'; + + +create trigger pinds_blog_entries__itrg after insert on pinds_blog_entries +for each row execute procedure pinds_blog_entries__itrg (); + +create trigger pinds_blog_entries__dtrg after delete on pinds_blog_entries +for each row execute procedure pinds_blog_entries__dtrg (); + +create trigger pinds_blog_entries__utrg after update on pinds_blog_entries +for each row execute procedure pinds_blog_entries__utrg (); + +-- Add the binding + +select acs_sc_binding__new ( + 'FtsContentProvider', + 'pinds_blog_entry' +); Index: openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-sc-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-sc-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/sql/postgresql/lars-blogger-sc-drop.sql 30 Nov 2002 17:36:59 -0000 1.2 @@ -0,0 +1,35 @@ +-- Drop the lars blogger implementation of the FtsContentProvider +-- service contract + +select acs_sc_binding__delete( + 'FtsContentProvider', -- impl_contract_name + 'pinds_blog_entries' -- impl_name +); + +select acs_sc_impl__delete( + 'FtsContentProvider', -- impl_contract_name + 'pinds_blog_entries' -- impl_name +); + +select acs_sc_impl_alias__delete( + 'FtsContentProvider', -- impl_contract_name + 'pinds_blog_entries', -- impl_name + 'datasource' -- impl_operation_name +); + +select acs_sc_impl_alias__delete( + 'FtsContentProvider', -- impl_contract_name + 'pinds_blog_entries', -- impl_name + 'url' -- impl_operation_name +); + +-- Drop the database triggers on pinds_blog_entries + +drop trigger pinds_blog_entries__utrg on pinds_blog_entries; +drop trigger pinds_blog_entries__dtrg on pinds_blog_entries; +drop trigger pinds_blog_entries__itrg on pinds_blog_entries; + +drop function pinds_blog_entries__utrg (); +drop function pinds_blog_entries__dtrg (); +drop function pinds_blog_entries__itrg (); + Index: openacs-4/packages/lars-blogger/sql/postgresql/upgrade/lars-blogger-sc-index.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/upgrade/lars-blogger-sc-index.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/sql/postgresql/upgrade/lars-blogger-sc-index.sql 30 Nov 2002 17:37:08 -0000 1.2 @@ -0,0 +1,20 @@ +-- Index the existing blog entries +-- +-- @author Bart Teeuwisse (bart.teeuwisse@thecodemill.biz) +-- @creation-date 2002-11-18 + +create function inline_0 () +returns integer as ' +declare + blog_entry pinds_blog_entries%rowtype; +begin + + for blog_entry in select * from pinds_blog_entries where draft_p = ''f'' and deleted_p = ''f'' loop + perform search_observer__enqueue(blog_entry.entry_id, ''INSERT''); + end loop; + + return null; +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0 (); Index: openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.6.4d-0.7d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.6.4d-0.7d.sql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.6.4d-0.7d.sql 24 Sep 2002 15:24:21 -0000 1.2 +++ openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.6.4d-0.7d.sql 30 Nov 2002 17:37:08 -0000 1.3 @@ -2,18 +2,19 @@ -- upgrade-0.6.4d-0.7d.sql -- -- @author Vinod Kurup (vinod@kurup.com) +-- @author Bart Teeuwisse (bart.teeuwisse@thecodemill.biz) -- -- @cvs-id $Id$ -- --- the only change is in the name of a proc that we send to --- asc_sc_impl_alias. So, we just delete the old alias --- and create a new one with the proper proc name (lars_blog...) +-- Change the name of a proc that we send to asc_sc_impl_alias. +-- Delete the old alias and create a new one with the proper proc name +-- (lars_blog...) select acs_sc_impl_alias__delete( - 'RssGenerationSubscriber', -- impl_contract_name + 'RssGenerationSubscriber', -- impl_contract_name 'pinds_blog_entries', -- impl_name - 'lastUpdated' -- impl_operation_name + 'lastUpdated' -- impl_operation_name ); @@ -25,3 +26,6 @@ 'TCL' -- impl_pl ); +-- Index the existing published blog entries + +\i lars-blogger-sc-index.sql Index: openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.7d-0.8.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.7d-0.8.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.7d-0.8.sql 14 Sep 2002 21:43:35 -0000 1.1 +++ openacs-4/packages/lars-blogger/sql/postgresql/upgrade/upgrade-0.7d-0.8.sql 30 Nov 2002 17:37:08 -0000 1.2 @@ -2,10 +2,15 @@ -- upgrade-0.7d-0.8.sql -- -- @author Lars Pind +-- @author Bart Teeuwisse (bart.teeuwisse@thecodemill.biz) -- -- @cvs-id $Id$ -- -- added notifications \i ../notifications-init.sql + +-- Index the existing published blog entries + +\i lars-blogger-sc-index.sql Index: openacs-4/packages/lars-blogger/tcl/pinds-blog-entry-sc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/tcl/pinds-blog-entry-sc-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/tcl/pinds-blog-entry-sc-procs.tcl 30 Nov 2002 17:37:17 -0000 1.2 @@ -0,0 +1,48 @@ +ad_library { + Lars blogger search procs. + + @author Bart Teeuwisse (bart.teeuwisse@thecodemill.biz) + @creation-date 2002-11-18 + @cvs $Id: pinds-blog-entry-sc-procs.tcl,v 1.2 2002/11/30 17:37:17 jeffd Exp $ +} + +ad_proc pinds_blog_entry__datasource { + object_id +} { + @author Bart Teeuwisse (bart.teeuwisse@thecodemill.biz) + @creation-date 2002-11-18 +} { + db_0or1row pinds_blog_entry_datasource { + select e.entry_id as object_id, + e.title as title, + e.content as content, + 'text/html' as mime, + '' as keywords, + 'text' as storage_type + from pinds_blog_entries e + where e.entry_id = :object_id + } -column_array datasource + + return [array get datasource] +} + + +ad_proc pinds_blog_entry__url { + object_id +} { + @author Bart Teeuwisse (bart.teeuwisse@thecodemill.biz) + @creation-date 2002-11-18 +} { + + db_1row get_url_stub " + select site_node__url(node_id) as url_stub + from site_nodes s, pinds_blog_entries e + where e.entry_id = :object_id + and s.object_id = e.package_id" + + set url "${url_stub}one-entry?entry_id=$object_id" + + return $url +} + + 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.1 -r1.2 --- openacs-4/packages/lars-blogger/tcl/rss-procs-oracle.xql 19 Aug 2002 21:52:59 -0000 1.1 +++ openacs-4/packages/lars-blogger/tcl/rss-procs-oracle.xql 30 Nov 2002 17:37:17 -0000 1.2 @@ -19,6 +19,8 @@ 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 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.1 -r1.2 --- openacs-4/packages/lars-blogger/tcl/rss-procs-postgresql.xql 19 Aug 2002 21:52:59 -0000 1.1 +++ openacs-4/packages/lars-blogger/tcl/rss-procs-postgresql.xql 30 Nov 2002 17:37:17 -0000 1.2 @@ -18,8 +18,11 @@ 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 where package_id = :package_id and draft_p = 'f' @@ -31,8 +34,10 @@ - select coalesce (date_part('epoch',max(posted_date)),0) as last_update - from pinds_blog_entries + 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' 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.2 -r1.3 --- openacs-4/packages/lars-blogger/tcl/rss-procs.tcl 14 Sep 2002 16:40:33 -0000 1.2 +++ openacs-4/packages/lars-blogger/tcl/rss-procs.tcl 30 Nov 2002 17:37:17 -0000 1.3 @@ -43,6 +43,8 @@ set counter 0 db_foreach blog_rss_items { *SQL* } { + set TZoffset [format "%+03d:%02d" $tzoffset_hour $tzoffset_minute] + set entry_url "[ad_url]${package_url}archive/${entry_archive_url}#blog-entry-$entry_id" set content [ns_adp_parse -string $content] @@ -56,7 +58,7 @@ set description $content_as_text } - lappend items [list link $entry_url title $title description $description value $content timestamp "${posted_date_string}T${posted_time_string}-0600"] + lappend items [list link $entry_url title $title description $description value $content timestamp "${posted_date_string}T${posted_time_string}$TZoffset"] if { $counter == 0 } { set column_array(channel_lastBuildDate) $entry_date_pretty incr counter @@ -83,7 +85,9 @@ @author Lars Pind (lars@pinds.com) } { db_0or1row get_last_update { - select coalesce (date_part('epoch',max(posted_date)),0) as 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' @@ -92,5 +96,3 @@ return $last_update } - - 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.3 -r1.4 --- openacs-4/packages/lars-blogger/www/blog-postgresql.xql 14 Sep 2002 18:05:12 -0000 1.3 +++ openacs-4/packages/lars-blogger/www/blog-postgresql.xql 30 Nov 2002 17:37:27 -0000 1.4 @@ -20,7 +20,7 @@ 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, + to_char(entry_date, 'YYYY-MM-DD') as entry_date, title, content, draft_p, 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.9 -r1.10 --- openacs-4/packages/lars-blogger/www/blog.adp 16 Sep 2002 15:04:27 -0000 1.9 +++ openacs-4/packages/lars-blogger/www/blog.adp 30 Nov 2002 17:37:27 -0000 1.10 @@ -27,15 +27,16 @@

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

    \ No newline at end of file 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.2 -r1.3 --- openacs-4/packages/lars-blogger/www/entry-chunk.adp 14 Sep 2002 21:43:37 -0000 1.2 +++ openacs-4/packages/lars-blogger/www/entry-chunk.adp 30 Nov 2002 17:37:27 -0000 1.3 @@ -2,14 +2,15 @@

    @blog.title@

    - @blog.content@ -
    +@blog.content@ +

    +
    -
    +
    Posted by @blog.poster_first_names@ @blog.poster_last_name@ at @blog.posted_time_pretty@      @@ -40,7 +41,6 @@
    -


    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.9 -r1.10 --- openacs-4/packages/lars-blogger/www/index.adp 16 Sep 2002 15:04:27 -0000 1.9 +++ openacs-4/packages/lars-blogger/www/index.adp 30 Nov 2002 17:37:27 -0000 1.10 @@ -1,9 +1,7 @@ @page_title@ - - - + @context_bar@ 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.4 -r1.5 --- openacs-4/packages/lars-blogger/www/index.tcl 16 Sep 2002 09:25:51 -0000 1.4 +++ openacs-4/packages/lars-blogger/www/index.tcl 30 Nov 2002 17:37:27 -0000 1.5 @@ -17,7 +17,7 @@ set page_title [lars_blog_name] if { ![empty_string_p [ad_parameter "rss_file_url"]] } { - set rss_file_url "[ad_url][ad_parameter "rss_file_url"]" + set rss_file_url "[ad_conn url]/[ad_parameter "rss_file_url"]" } set admin_p [ad_permission_p [ad_conn package_id] admin] @@ -58,4 +58,4 @@ set archive_date "" } -ad_return_template \ No newline at end of file +ad_return_template 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.3 -r1.4 --- openacs-4/packages/lars-blogger/www/admin/index.adp 16 Sep 2002 13:01:34 -0000 1.3 +++ openacs-4/packages/lars-blogger/www/admin/index.adp 30 Nov 2002 17:37:43 -0000 1.4 @@ -2,7 +2,8 @@ @title@ Index: openacs-4/packages/lars-blogger/www/admin/subscribers.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/admin/subscribers.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/admin/subscribers.adp 30 Nov 2002 17:37:43 -0000 1.2 @@ -0,0 +1,16 @@ + +E-mail subscribers +subscribers + + +
    + +No subscribers. + \ No newline at end of file Index: openacs-4/packages/lars-blogger/www/admin/subscribers.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lars-blogger/www/admin/subscribers.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/admin/subscribers.tcl 30 Nov 2002 17:37:43 -0000 1.2 @@ -0,0 +1,17 @@ +set package_id [ad_conn package_id] + +db_multirow -extend {user_url} subscribers get_subscribers { + select r.request_id, + u.first_names || ' ' || u.last_name as name, + u.user_id, + u.email, + (select name + from notification_intervals i + where i.interval_id = r.interval_id) as interval, + r.object_id + from notification_requests r, cc_users u + where r.object_id = :package_id + and u.user_id = r.user_id +} { + set user_url [acs_community_member_url -user_id $user_id] +} 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 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lars-blogger/www/rss/index.vuh 30 Nov 2002 17:38:04 -0000 1.2 @@ -0,0 +1 @@ +ns_returnfile 200 text/xml [rss_gen_report_file -summary_context_id [ad_conn package_id] -impl_name pinds_blog_entries] Index: openacs-4/packages/news/news.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/news.info,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/news/news.info 31 May 2002 12:50:14 -0000 1.6 +++ openacs-4/packages/news/news.info 30 Nov 2002 17:38:21 -0000 1.7 @@ -7,19 +7,19 @@ f f - + oracle postgresql Stefan Deusch News application - 2001-03-07 - ArsDigita Corporation - News publication tool for corporate and website news in HTML and plain text format. + 2002-10-27 + OpenACS + News publication tool for corporate and website news in HTML and plain text format. Beta release. - + @@ -32,10 +32,12 @@ + + @@ -55,7 +57,6 @@ - @@ -103,19 +104,18 @@ - - - - - - + + + + + Index: openacs-4/packages/news/sql/oracle/upgrade/upgrade-4.1.0b-4.6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/sql/oracle/upgrade/upgrade-4.1.0b-4.6.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news/sql/oracle/upgrade/upgrade-4.1.0b-4.6.sql 30 Nov 2002 17:38:40 -0000 1.2 @@ -0,0 +1,581 @@ +-- news upgrade script +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2002-10-27 + +-- add procedure 'news.clone' +create or replace package news +as + function new ( + item_id in cr_items.item_id%TYPE default null, + -- + locale in cr_items.locale%TYPE default null, + -- + publish_date in cr_revisions.publish_date%TYPE default null, + text in varchar2 default null, + nls_language in cr_revisions.nls_language%TYPE default null, + title in cr_revisions.title%TYPE default null, + mime_type in cr_revisions.mime_type%TYPE default 'text/plain', + -- + package_id in cr_news.package_id%TYPE default null, + archive_date in cr_news.archive_date%TYPE default null, + approval_user in cr_news.approval_user%TYPE default null, + approval_date in cr_news.approval_date%TYPE default null, + approval_ip in cr_news.approval_ip%TYPE default null, + -- + relation_tag in cr_child_rels.relation_tag%TYPE + default null, + -- + item_subtype in acs_object_types.object_type%TYPE + default 'content_revision', + content_type in acs_object_types.object_type%TYPE + default 'news', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_ip in acs_objects.creation_ip%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + -- + is_live_p in varchar2 default 'f' + ) return cr_news.news_id%TYPE; + + procedure delete ( + item_id in cr_items.item_id%TYPE + ); + + procedure archive ( + item_id in cr_items.item_id%TYPE, + archive_date in cr_news.archive_date%TYPE default sysdate + ); + + procedure make_permanent ( + item_id in cr_items.item_id%TYPE + ); + + + procedure set_approve ( + revision_id in cr_revisions.revision_id%TYPE, + approve_p in varchar2 default 't', + publish_date in cr_revisions.publish_date%TYPE default null, + archive_date in cr_news.archive_date%TYPE default null, + approval_user in cr_news.approval_user%TYPE default null, + approval_date in cr_news.approval_date%TYPE default sysdate, + approval_ip in cr_news.approval_ip%TYPE default null, + live_revision_p in varchar2 default 't' + ); + + + + function status ( + news_id in cr_news.news_id%TYPE + ) return varchar2; + + + function name ( + news_id in cr_news.news_id%TYPE + ) return varchar2; + + + -- + -- API for revisions: e.g. when the news admin wants to revise a news item + -- + function revision_new ( + item_id in cr_items.item_id%TYPE, + -- + publish_date in cr_revisions.publish_date%TYPE default null, + text in varchar2 default null, + title in cr_revisions.title%TYPE, + -- + -- here goes the revision log + description in cr_revisions.description%TYPE, + -- + mime_type in cr_revisions.mime_type%TYPE default 'text/plain', + package_id in cr_news.package_id%TYPE default null, + archive_date in cr_news.archive_date%TYPE default null, + approval_user in cr_news.approval_user%TYPE default null, + approval_date in cr_news.approval_date%TYPE default null, + approval_ip in cr_news.approval_ip%TYPE default null, + -- + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_ip in acs_objects.creation_ip%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + -- + make_active_revision_p in varchar2 default 'f' + ) return cr_revisions.revision_id%TYPE; + + + procedure revision_delete ( + revision_id in cr_revisions.revision_id%TYPE + ); + + + procedure revision_set_active ( + revision_id in cr_revisions.revision_id%TYPE + ); + + procedure clone ( + new_package_id in cr_news.package_id%TYPE default null, + old_package_id in cr_news.package_id%TYPE default null + ); + +end news; +/ +show errors + + + +create or replace package body news + as + function new ( + item_id in cr_items.item_id%TYPE default null, + -- + locale in cr_items.locale%TYPE default null, + -- + publish_date in cr_revisions.publish_date%TYPE default null, + text in varchar2 default null, + nls_language in cr_revisions.nls_language%TYPE default null, + title in cr_revisions.title%TYPE default null, + mime_type in cr_revisions.mime_type%TYPE default + 'text/plain', + -- + package_id in cr_news.package_id%TYPE default null, + archive_date in cr_news.archive_date%TYPE default null, + approval_user in cr_news.approval_user%TYPE default null, + approval_date in cr_news.approval_date%TYPE default null, + approval_ip in cr_news.approval_ip%TYPE default null, + -- + relation_tag in cr_child_rels.relation_tag%TYPE default null, + -- + item_subtype in acs_object_types.object_type%TYPE default + 'content_revision', + content_type in acs_object_types.object_type%TYPE default 'news', + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_ip in acs_objects.creation_ip%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + -- + is_live_p in varchar2 default 'f' + ) return cr_news.news_id%TYPE + is + v_news_id integer; + v_item_id integer; + v_id integer; + v_revision_id integer; + v_parent_id integer; + v_name varchar2(200); + v_log_string varchar2(400); + begin + select content_item.get_id('news') + into v_parent_id + from dual; + -- + -- this will be used for 2xClick protection + if item_id is null then + select acs_object_id_seq.nextval + into v_id + from dual; + else + v_id := item_id; + end if; + -- + select 'news' || to_char(sysdate,'YYYYMMDD') || v_id + into v_name + from dual; + -- + v_log_string := 'initial submission'; + -- + v_item_id := content_item.new( + item_id => v_id, + name => v_name, + parent_id => v_parent_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_user => creation_user + ); + v_revision_id := content_revision.new( + title => title, + description => v_log_string, + publish_date => publish_date, + mime_type => mime_type, + nls_language => nls_language, + text => text, + item_id => v_item_id, + creation_date => creation_date, + creation_ip => creation_ip, + creation_user => creation_user + ); + insert into cr_news + (news_id, + package_id, + archive_date, + approval_user, + approval_date, + approval_ip) + values + (v_revision_id, + package_id, + archive_date, + approval_user, + approval_date, + approval_ip); + -- make this revision live when immediately approved + if is_live_p = 't' then + update + cr_items + set + live_revision = v_revision_id, + publish_status = 'ready' + where + item_id = v_item_id; + end if; + v_news_id := v_revision_id; + return v_news_id; + end new; + + + -- deletes a news item along with all its revisions and possibnle attachements + procedure delete ( + item_id in cr_items.item_id%TYPE + ) is + v_item_id cr_items.item_id%TYPE; + + cursor comment_cursor IS + select message_id + from acs_messages am, acs_objects ao + where am.message_id = ao.object_id + and ao.context_id = v_item_id; + + begin + v_item_id := news.delete.item_id; + dbms_output.put_line('Deleting associated comments...'); + -- delete acs_messages, images, comments to news item + for v_cm in comment_cursor loop + -- images + delete from images + where image_id in (select latest_revision + from cr_items + where parent_id = v_cm.message_id); + acs_message.delete(v_cm.message_id); + delete from general_comments + where comment_id = v_cm.message_id; + end loop; + delete from cr_news + where news_id in (select revision_id + from cr_revisions + where item_id = v_item_id); + content_item.delete(v_item_id); + end delete; + + + -- (re)-publish a news item out of the archive by nulling the archive_date + -- this only applies to the currently active revision + procedure make_permanent ( + item_id in cr_items.item_id%TYPE + ) + is + begin + update cr_news + set archive_date = null + where news_id = content_item.get_live_revision(news.make_permanent.item_id); + end make_permanent; + + + -- archive a news item + -- this only applies to the currently active revision + procedure archive ( + item_id in cr_items.item_id%TYPE, + archive_date in cr_news.archive_date%TYPE default sysdate + ) + is + begin + update cr_news + set archive_date = news.archive.archive_date + where news_id = content_item.get_live_revision(news.archive.item_id); + end archive; + + + -- approve/unapprove a specific revision + -- approving a revision makes it also the active revision + procedure set_approve( + revision_id in cr_revisions.revision_id%TYPE, + approve_p in varchar2 default 't', + publish_date in cr_revisions.publish_date%TYPE default null, + archive_date in cr_news.archive_date%TYPE default null, + approval_user in cr_news.approval_user%TYPE default null, + approval_date in cr_news.approval_date%TYPE default sysdate, + approval_ip in cr_news.approval_ip%TYPE default null, + live_revision_p in varchar2 default 't' + ) + is + v_item_id cr_items.item_id%TYPE; + begin + select item_id into v_item_id + from cr_revisions + where revision_id = news.set_approve.revision_id; + -- unapprove an revision (does not mean to knock out active revision) + if news.set_approve.approve_p = 'f' then + update cr_news + set approval_date = null, + approval_user = null, + approval_ip = null, + archive_date = null + where news_id = news.set_approve.revision_id; + -- + update cr_revisions + set publish_date = null + where revision_id = news.set_approve.revision_id; + else + -- approve a revision + update cr_revisions + set publish_date = news.set_approve.publish_date + where revision_id = news.set_approve.revision_id; + -- + update cr_news + set archive_date = news.set_approve.archive_date, + approval_date = news.set_approve.approval_date, + approval_user = news.set_approve.approval_user, + approval_ip = news.set_approve.approval_ip + where news_id = news.set_approve.revision_id; + -- + -- cannot use content_item.set_live_revision because it sets publish_date to sysdate + if news.set_approve.live_revision_p = 't' then + update cr_items + set live_revision = news.set_approve.revision_id, + publish_status = 'ready' + where item_id = v_item_id; + end if; + -- + end if; + end set_approve; + + + + -- the status function returns information on the puplish or archive status + -- it does not make any checks on the order of publish_date and archive_date + function status ( + news_id in cr_news.news_id%TYPE + ) return varchar2 + is + v_archive_date date; + v_publish_date date; + begin + -- populate variables + select archive_date into v_archive_date + from cr_news + where news_id = news.status.news_id; + -- + select publish_date into v_publish_date + from cr_revisions + where revision_id = news.status.news_id; + + -- if publish_date is not null the item is approved, otherwise it is not + if v_publish_date is not null then + if v_publish_date > sysdate then + -- to be published (2 cases) + -- archive date could be null if it has not been decided when to archive + if v_archive_date is null then + return 'going live in ' || + round(to_char(v_publish_date - sysdate),1) || ' days'; + else + return 'going live in ' || + round(to_char(v_publish_date - sysdate),1) || ' days' || + ', archived in ' || round(to_char(v_archive_date - sysdate),1) || ' days'; + end if; + else + -- already released or even archived (3 cases) + if v_archive_date is null then + return 'published, not scheduled for archive'; + else + if v_archive_date - sysdate > 0 then + return 'published, archived in ' || + round(to_char(v_archive_date - sysdate),1) || ' days'; + else + return 'archived'; + end if; + end if; + end if; + else + return 'unapproved'; + end if; + end status; + + + function name ( + news_id in cr_news.news_id%TYPE + ) return varchar2 + is + news_title varchar2(1000); + begin + select title + into news_title + from cr_revisions + where revision_id = news.name.news_id; + + return news_title; + end name; + + + -- + -- API for Revision management + -- + function revision_new ( + item_id in cr_items.item_id%TYPE, + -- + publish_date in cr_revisions.publish_date%TYPE default null, + text in varchar2 default null, + title in cr_revisions.title%TYPE, + -- + -- here goes the revision log + description in cr_revisions.description%TYPE, + -- + mime_type in cr_revisions.mime_type%TYPE default 'text/plain', + package_id in cr_news.package_id%TYPE default null, + archive_date in cr_news.archive_date%TYPE default null, + approval_user in cr_news.approval_user%TYPE default null, + approval_date in cr_news.approval_date%TYPE default null, + approval_ip in cr_news.approval_ip%TYPE default null, + -- + creation_date in acs_objects.creation_date%TYPE default sysdate, + creation_ip in acs_objects.creation_ip%TYPE default null, + creation_user in acs_objects.creation_user%TYPE default null, + -- + make_active_revision_p in varchar2 default 'f' + ) return cr_revisions.revision_id%TYPE + is + v_revision_id integer; + begin + -- create revision + v_revision_id := content_revision.new( + title => title, + description => description, + publish_date => publish_date, + mime_type => mime_type, + text => text, + item_id => item_id, + creation_date => creation_date, + creation_user => creation_user, + creation_ip => creation_ip + ); + -- create new news entry with new revision + insert into cr_news + (news_id, + package_id, + archive_date, + approval_user, + approval_date, + approval_ip) + values + (v_revision_id, + package_id, + archive_date, + approval_user, + approval_date, + approval_ip); + -- make active revision if indicated + if make_active_revision_p = 't' then + news.revision_set_active(v_revision_id); + end if; + return v_revision_id; + end revision_new; + + + + procedure revision_set_active ( + revision_id in cr_revisions.revision_id%TYPE + ) + is + v_news_item_p char; + -- could be used to check if really a 'news' item + begin + update + cr_items + set + live_revision = news.revision_set_active.revision_id, + publish_status = 'ready' + where + item_id = (select + item_id + from + cr_revisions + where + revision_id = news.revision_set_active.revision_id); + end revision_set_active; + + + procedure clone ( + new_package_id in cr_news.package_id%TYPE default null, + old_package_id in cr_news.package_id%TYPE default null + ) + is + new_news_id integer; + begin + for one_news in (select + publish_date, + content.blob_to_string(cr.content) as text, + cr.nls_language, + cr.title as title, + cr.mime_type, + cn.package_id, + archive_date, + approval_user, + approval_date, + approval_ip, + ao.creation_date, + ao.creation_ip, + ao.creation_user + from + cr_items ci, + cr_revisions cr, + cr_news cn, + acs_objects ao + where + (ci.item_id = cr.item_id + and ci.live_revision = cr.revision_id + and cr.revision_id = cn.news_id + and cr.revision_id = ao.object_id) + or (ci.live_revision is null + and ci.item_id = cr.item_id + and cr.revision_id = content_item.get_latest_revision(ci.item_id) + and cr.revision_id = cn.news_id + and cr.revision_id = ao.object_id)) + loop + + new_news_id := news.new( + publish_date => one_news.publish_date, + text => one_news.text, + nls_language => one_news.nls_language, + title => one_news.title, + mime_type => one_news.mime_type, + package_id => news.clone.new_package_id, + archive_date => one_news.archive_date, + approval_user => one_news.approval_user, + approval_date => one_news.approval_date, + approval_ip => one_news.approval_ip, + creation_date => one_news.creation_date, + creation_ip => one_news.creation_ip, + creation_user => one_news.creation_user + ); + + end loop; + end clone; + + -- currently not used, because we want to audit revisions + procedure revision_delete ( + revision_id in cr_revisions.revision_id%TYPE + ) + is + begin + -- delete from cr_news table + delete from cr_news + where news_id = news.revision_delete.revision_id; + -- delete revision + content_revision.delete( + revision_id => news.revision_delete.revision_id + ); + end revision_delete; + +end news; +/ +show errors Index: openacs-4/packages/news/sql/postgresql/upgrade/upgrade-4.1.0b-4.6.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/sql/postgresql/upgrade/upgrade-4.1.0b-4.6.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/news/sql/postgresql/upgrade/upgrade-4.1.0b-4.6.sql 30 Nov 2002 17:38:58 -0000 1.2 @@ -0,0 +1,64 @@ +-- news upgrade script +-- @author Vinod Kurup (vinod@kurup.com) +-- @creation-date 2002-10-27 + +-- new function news__clone + +create or replace function news__clone (integer, integer) +returns integer as ' +declare + p_new_package_id alias for $1; --default null, + p_old_package_id alias for $2; --default null + one_news record; +begin + for one_news in select + publish_date, + cr.content as text, + cr.nls_language, + cr.title as title, + cr.mime_type, + cn.package_id, + archive_date, + approval_user, + approval_date, + approval_ip, + ao.creation_date, + ao.creation_ip, + ao.creation_user + from + cr_items ci, + cr_revisions cr, + cr_news cn, + acs_objects ao + where + (ci.item_id = cr.item_id + and ci.live_revision = cr.revision_id + and cr.revision_id = cn.news_id + and cr.revision_id = ao.object_id) + or (ci.live_revision is null + and ci.item_id = cr.item_id + and cr.revision_id = content_item__get_latest_revision(ci.item_id) + and cr.revision_id = cn.news_id + and cr.revision_id = ao.object_id) + + loop + perform news__new( + one_news.publish_date, + one_news.text, + one_news.nls_language, + one_news.title, + one_news.mime_type, + new_package_id, + one_news.archive_date, + one_news.approval_user, + one_news.approval_date, + one_news.approval_ip, + one_news.creation_date, + one_news.creation_ip, + one_news.creation_user + ); + + end loop; + return 0; +end; +' language 'plpgsql'; Index: openacs-4/packages/news/tcl/news-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-procs-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/news/tcl/news-procs-oracle.xql 25 Oct 2001 11:39:29 -0000 1.2 +++ openacs-4/packages/news/tcl/news-procs-oracle.xql 30 Nov 2002 17:39:09 -0000 1.3 @@ -44,6 +44,7 @@ select site_node.url(node_id) as url_stub from site_nodes where object_id=:package_id + and rownum = 1 Index: openacs-4/packages/news/tcl/news-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-procs-postgresql.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/news/tcl/news-procs-postgresql.xql 25 Oct 2001 11:39:29 -0000 1.2 +++ openacs-4/packages/news/tcl/news-procs-postgresql.xql 30 Nov 2002 17:39:09 -0000 1.3 @@ -39,6 +39,7 @@ select site_node__url(node_id) as url_stub from site_nodes where object_id=:package_id + limit 1 Index: openacs-4/packages/news/www/item-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/Attic/item-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/news/www/item-oracle.xql 16 Oct 2001 10:10:19 -0000 1.2 +++ openacs-4/packages/news/www/item-oracle.xql 30 Nov 2002 17:39:19 -0000 1.3 @@ -10,7 +10,7 @@ publish_title, html_p, publish_date, - '' || item_creator || '' as creator_link + '' || item_creator || '' as creator_link from news_items_live_or_submitted where item_id = :item_id Index: openacs-4/packages/news/www/item-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/Attic/item-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/news/www/item-postgresql.xql 15 Oct 2001 13:41:03 -0000 1.1 +++ openacs-4/packages/news/www/item-postgresql.xql 30 Nov 2002 17:39:19 -0000 1.2 @@ -11,7 +11,7 @@ html_p, publish_date, publish_body, - '' || item_creator || '' as creator_link + '' || item_creator || '' as creator_link from news_items_live_or_submitted where item_id = :item_id Index: openacs-4/packages/news/www/admin/revision-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/admin/revision-oracle.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/news/www/admin/revision-oracle.xql 16 Oct 2001 10:10:19 -0000 1.2 +++ openacs-4/packages/news/www/admin/revision-oracle.xql 30 Nov 2002 17:39:28 -0000 1.3 @@ -15,7 +15,7 @@ archive_date, creation_ip, creation_date, - '' || item_creator || '' as creator_link + '' || item_creator || '' as creator_link from news_item_revisions where item_id = :item_id and revision_id = :revision_id Index: openacs-4/packages/news/www/admin/revision-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/admin/revision-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/news/www/admin/revision-postgresql.xql 15 Oct 2001 13:41:03 -0000 1.1 +++ openacs-4/packages/news/www/admin/revision-postgresql.xql 30 Nov 2002 17:39:28 -0000 1.2 @@ -16,7 +16,7 @@ creation_ip, creation_date, publish_body, - '' || item_creator || '' as creator_link + '' || item_creator || '' as creator_link from news_item_revisions where item_id = :item_id and revision_id = :revision_id Index: openacs-4/packages/notes/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notes/www/index-oracle.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/notes/www/index-oracle.xql 3 May 2001 18:23:35 -0000 1.1 +++ openacs-4/packages/notes/www/index-oracle.xql 30 Nov 2002 17:39:52 -0000 1.2 @@ -1,5 +1,6 @@ +oracle8.1.6 Index: openacs-4/packages/notifications/notifications.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/notifications.info,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/notifications/notifications.info 23 Sep 2002 23:32:23 -0000 1.11 +++ openacs-4/packages/notifications/notifications.info 30 Nov 2002 17:40:04 -0000 1.12 @@ -87,7 +87,7 @@ - + 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.5 -r1.6 --- openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 20 Sep 2002 21:19:00 -0000 1.5 +++ openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 30 Nov 2002 17:40:18 -0000 1.6 @@ -1,7 +1,13 @@ ad_library { Notification Delivery Methods + + Functions to support notification delivery methods. A delivery method is a means by which + a notification is sent to a user. "Email" is a common one, but others, like "sms", may exist. + The delivery method integration is done via acs-service-contract: any new delivery method must implement + this service contract. + @creation-date 2002-05-24 @author Ben Adida @cvs-id $Id$ @@ -13,6 +19,8 @@ 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 {}] } @@ -24,7 +32,9 @@ {-subject:required} {-content:required} } { - do the delivery of certain content to a particular user + 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] } { @@ -45,7 +55,11 @@ ad_proc -public scan_replies { {-delivery_method_id:required} } { - scan for replies + 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] Index: openacs-4/packages/notifications/tcl/interval-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/interval-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/notifications/tcl/interval-procs.tcl 24 May 2002 20:42:42 -0000 1.1 +++ openacs-4/packages/notifications/tcl/interval-procs.tcl 30 Nov 2002 17:40:18 -0000 1.2 @@ -1,7 +1,12 @@ ad_library { - Notification Intervals + Notification Intervals. + Procs to manage notification intervals. Intervals are the duration of time between notifications. + Possible intervals range from "instantaneous" to "weekly". + + CURRENTLY DEPRECATED AND USELESS. + @creation-date 2002-05-24 @author Ben Adida @cvs-id $Id$ Index: openacs-4/packages/notifications/tcl/notification-display-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-display-procs.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/notifications/tcl/notification-display-procs.tcl 8 Nov 2002 10:04:22 -0000 1.5 +++ openacs-4/packages/notifications/tcl/notification-display-procs.tcl 30 Nov 2002 17:40:18 -0000 1.6 @@ -1,7 +1,10 @@ ad_library { - Notifications Display Procs + Notifications Display Procs. + Notifications is mostly a service package, but it does have some level of user interface. + These procs enable other packages to simply display information about notifications. + @creation-date 2002-05-24 @author Ben Adida @cvs-id $Id$ @@ -17,7 +20,7 @@ {-url:required} {-user_id ""} } { - Produce a widget for requesting notifications + Produce a widget for requesting notifications of a given type. } { if {[empty_string_p $user_id]} { set user_id [ad_conn user_id] @@ -47,6 +50,8 @@ {-user_id:required} {-pretty_name} } { + Returns the URL that allows one to subscribe to a notification type on a particular object. + } { set type_id [notification::type::get_type_id -short_name $type] set root_path [apm_package_url_from_key [notification::package_key]] @@ -59,6 +64,8 @@ {-request_id:required} {-url:required} } { + Returns the URL that allows one to unsubscribe from a particular request. + } { set root_path [apm_package_url_from_key [notification::package_key]] set unsubscribe_url "${root_path}request-delete?request_id=$request_id&return_url=[ns_urlencode $url]" 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.10 -r1.11 --- openacs-4/packages/notifications/tcl/notification-email-procs.tcl 8 Nov 2002 10:04:22 -0000 1.10 +++ openacs-4/packages/notifications/tcl/notification-email-procs.tcl 30 Nov 2002 17:40:18 -0000 1.11 @@ -22,11 +22,19 @@ } ad_proc -public address_domain {} { - return [get_parameter -name "EmailDomain"] + set domain [get_parameter -name "EmailDomain"] + if { [empty_string_p $domain] } { + # No domain set up, let's use the default from the system info + # This may not find anything, but at least it's worth a try + if { ![regexp {^(https?://)?(www\.)?([^/]*)} [ad_url] match ignore ignore domain] } { + ns_log Warning "notification::email::address_domain: Couldn't find an email domain for notifications." + } + } + return $domain } ad_proc -public manage_notifications_url {} { - return "[ad_url]/[apm_package_url_from_key [notification::package_key]]manage" + return "[ad_url][apm_package_url_from_key [notification::package_key]]manage" } ad_proc -public reply_address_prefix {} { 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.3 -r1.4 --- openacs-4/packages/notifications/tcl/notification-procs.tcl 30 May 2002 06:26:09 -0000 1.3 +++ openacs-4/packages/notifications/tcl/notification-procs.tcl 30 Nov 2002 17:40:18 -0000 1.4 @@ -2,6 +2,14 @@ Notifications + Core procs for managing notifications. Important concepts: +
      +
    • notification: a single message that needs to be sent to users. +
    • intervals: the duration of time between notifications. Ranges from "instantaneous" to "weekly". +
    • delivery method: the means by which a notification is delivered. "email" is the obvious one, but "sms" might be another. +
    • notification type: a category of notifications, like forum_notification for forum postings, or forum_statistics for regular updates on forum statistics (this latest one is for illustration purposes only and doesn't currently exist in the forums package). +
    + @creation-date 2002-05-24 @author Ben Adida @cvs-id $Id$ @@ -11,34 +19,53 @@ namespace eval notification { ad_proc -public package_key {} { + The package key + } { return "notifications" } ad_proc -public get_interval_id { {-name:required} } { + obtain the interval ID for an interval with the given name. + Interval names are unique, but are not the primary key. + } { return [db_string select_interval_id {} -default ""] } ad_proc -public get_delivery_method_id { {-name:required} } { + obtain the delivery method ID with the given name. + Delivery method names are unique, but are not the primary key. + } { return [db_string select_delivery_method_id {} -default ""] } ad_proc -public get_all_intervals {} { + return a list of all available intervals in a list of lists format, + with the following fields: name, interval_id, n_seconds. + } { return [db_list_of_lists select_all_intervals {}] } ad_proc -public get_intervals { {-type_id:required} } { + return a list of intervals that are associated with a given notification type + (not all intervals are available to all notification types). + The fields for each interval is: name, interval_id, n_seconds. + } { return [db_list_of_lists select_intervals {}] } ad_proc -public get_delivery_methods { {-type_id:required} } { + return a list of delivery methods associated with a given notification type + (not all delivery methods are available to all notification types). + The fields are: pretty_name, delivery_method_id + } { return [db_list_of_lists select_delivery_methods {}] } 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.3 -r1.4 --- openacs-4/packages/notifications/tcl/notification-reply-procs.tcl 29 Jun 2002 00:21:11 -0000 1.3 +++ openacs-4/packages/notifications/tcl/notification-reply-procs.tcl 30 Nov 2002 17:40:18 -0000 1.4 @@ -1,7 +1,10 @@ ad_library { - Notification Replies + Notification Replies. + When a user replies to a notification, this reply must be stored and handled appropriately. + These procs help to manage such handling. + @creation-date 2002-06-02 @author Ben Adida @cvs-id $Id$ @@ -19,7 +22,7 @@ {-content:required} {-reply_date ""} } { - create a new reply + store a new reply } { set extra_vars [ns_set create] oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {reply_id object_id type_id from_user subject content reply_date} @@ -33,7 +36,7 @@ {-reply_id:required} {-array:required} } { - Get the information for the reply + Get the information for the reply in a Tcl array } { # Select the info into the upvar'ed Tcl Array upvar $array row @@ -43,7 +46,7 @@ ad_proc -public delete { {-reply_id:required} } { - delete a reply + delete a reply, usually after it's been processed. } { db_exec_plsql delete_reply {} } Index: openacs-4/packages/notifications/tcl/notification-request-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-request-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/notifications/tcl/notification-request-procs.tcl 4 Jun 2002 06:44:02 -0000 1.3 +++ openacs-4/packages/notifications/tcl/notification-request-procs.tcl 30 Nov 2002 17:40:18 -0000 1.4 @@ -2,6 +2,10 @@ Notification Requests + When a user wishes to receive notifications of a certain type on a given object, + he issues a notification request. This request is recorded specifically for that user. + These procs help to manage such requests. + @creation-date 2002-05-24 @author Ben Adida @cvs-id $Id$ @@ -19,7 +23,7 @@ {-delivery_method_id:required} {-format "text"} } { - create a new request + create a new request for a given user, notification type, object, interval and delivery method. } { set request_id [get_request_id -type_id $type_id -object_id $object_id -user_id $user_id] @@ -40,15 +44,18 @@ {-object_id:required} {-user_id:required} } { - Checks if a particular notification request exists + Checks if a particular notification request exists, and if so return the request ID. + Note that the primary key on notification requests is notification_type, object, user. + Interval and delivery method are specific parameters, but do not impact the uniqueness: + a user can choose only one interval and delivery method for a given notification type and object. } { return [db_string select_request_id {} -default {}] } ad_proc -public delete { {-request_id:required} } { - delete a request + delete a request for notifications by request ID. } { # do the delete db_exec_plsql delete_request {} @@ -58,7 +65,7 @@ {-object_id:required} } { remove all requests for a particular object ID - usually because the object is getting deleted + usually because the object is getting deleted. } { # Do it db_exec_plsql delete_all_requests {} Index: openacs-4/packages/notifications/tcl/notification-type-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-type-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/notifications/tcl/notification-type-procs.tcl 29 Jun 2002 00:21:11 -0000 1.3 +++ openacs-4/packages/notifications/tcl/notification-type-procs.tcl 30 Nov 2002 17:40:18 -0000 1.4 @@ -2,6 +2,10 @@ Notification Types + Notifications are categorized by type. These procs manage the types. + Notification types are a service contract in order to handle notification replies appropriately + (handling a forum reply is not the same as handling a calendar reply). + @creation-date 2002-05-24 @author Ben Adida @cvs-id $Id$ @@ -13,6 +17,8 @@ ad_proc -public get_impl_key { {-type_id:required} } { + return the service contract implementation key for a given notification type. + } { return [db_string select_impl_key {}] } @@ -23,7 +29,7 @@ {-pretty_name:required} {-description ""} } { - create a new notification type + create a new notification type. Must provide a service contract implementation ID. } { set extra_vars [ns_set create] oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {type_id sc_impl_id short_name pretty_name description} @@ -36,12 +42,16 @@ ad_proc -public get_type_id { {-short_name:required} } { + return the notification type ID given a short name. Short names are unique but not primary keys. + } { return [db_string select_type_id {} -default {}] } ad_proc -public delete { {-short_name:required} } { + remove a notification type. This is very rare (and thus not even implemented right now). + } { set type_id [get_type_id -short_name $short_name] # do the delete @@ -52,6 +62,8 @@ {-short_name:required} {-column_array:required} } { + select information about the notification type into the given tcl Array + } { # Select the data into the upvar'ed array upvar $column_array row db_1row select_notification_type {} -column_array row @@ -61,6 +73,10 @@ {-type_id:required} {-interval_id:required} } { + Intervals must be enabled on a per notification type basis. For example, weekly notifications + may not be enabled for full forum posts, as that might be too much email (system choice) + This enables a given interval for a given notification type. + } { # Perform the insert if necessary db_dml insert_interval_map {} } @@ -69,6 +85,10 @@ {-type_id:required} {-interval_id:required} } { + Intervals must be enabled on a per notification type basis. For example, weekly notifications + may not be enabled for full forum posts, as that might be too much email (system choice) + This disables a given interval for a given notification type. + } { # perform the delete if necessary db_dml delete_interval_map {} } @@ -77,6 +97,10 @@ {-type_id:required} {-delivery_method_id:required} } { + Delivery methods must be enabled on a per notification type basis. For example, full forum posts + may not be enabled for SMS delivery, as that would be too long. + This enables a given delivery method for a given notification type. + } { # perform the insert if necessary db_dml insert_delivery_method_map {} } @@ -85,6 +109,10 @@ {-type_id:required} {-delivery_method_id:required} } { + Delivery methods must be enabled on a per notification type basis. For example, full forum posts + may not be enabled for SMS delivery, as that would be too long. + This disables a given delivery method for a given notification type. + } { # perform the delete if necessary db_dml delete_delivery_method_map {} } @@ -93,6 +121,9 @@ {-type_id:required} {-reply_id:required} } { + The wrapper procedure for processing a given reply. This calls down to the service contract + implementation to specifically handle a reply. + } { # Get the impl key set impl_key [get_impl_key -type_id $type_id] Index: openacs-4/packages/notifications/tcl/notifications-security-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notifications-security-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/notifications/tcl/notifications-security-procs.tcl 20 Sep 2002 23:17:36 -0000 1.3 +++ openacs-4/packages/notifications/tcl/notifications-security-procs.tcl 30 Nov 2002 17:40:18 -0000 1.4 @@ -1,6 +1,8 @@ ad_library { Notifications Security Library + + Manage permissions for notifications. @creation-date 2002-05-27 @author Ben Adida @@ -14,6 +16,7 @@ {-user_id:required} {-delivery_method_id ""} } { + Can a user be notified for a given delivery method. This proc can be expanded to deal with cases when we don't want to send a notification. For instance we could check email_bouncing_p or if a user is on vacation. Right now it just makes sure its an @@ -25,7 +28,10 @@ ad_proc -public can_notify_object_p { {-user_id ""} {-object_id:required} - } { + } { + This checks if a user can request notification on a given object. + Probably should just check read permission. RIGHT NOW HACKED to 1. + } { # hack return 1 } @@ -34,12 +40,16 @@ {-user_id ""} {-object_id:required} } { + Require the ability to notify on an object. + } { } ad_proc -public can_admin_request_p { {-user_id ""} {-request_id:required} } { + Checks if a user can manage a given notification request. RIGHT NOW HACKED to 1. + } { # hack return 1 } @@ -48,6 +58,8 @@ {-user_id ""} {-request_id:required} } { + Require the ability to admin a request + } { } Index: openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl 29 Jun 2002 00:21:11 -0000 1.3 +++ openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl 30 Nov 2002 17:40:18 -0000 1.4 @@ -1,7 +1,9 @@ ad_library { - Notification Reply Sweeps + Notification Reply Sweeps. + Procs that make sure that replies are being processed. + @creation-date 2002-06-02 @author Ben Adida @cvs-id $Id$ @@ -11,7 +13,7 @@ namespace eval notification::reply::sweep { ad_proc -public scan_all_replies {} { - # Go through all the delivery methods and do the right thing + Go through all the delivery methods and scan replies for that delivery method. } { ns_log Notice "NOTIF- scan_all_replies starting" @@ -26,7 +28,7 @@ } ad_proc -public process_all_replies {} { - # Go through the replies in the DB and dispatch correctly + Go through the replies in the DB and dispatch correctly to the right processor. } { ns_log Notice "NOTIF- process_all_replies starting" 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.10 -r1.11 --- openacs-4/packages/notifications/tcl/sweep-procs.tcl 8 Nov 2002 10:04:22 -0000 1.10 +++ openacs-4/packages/notifications/tcl/sweep-procs.tcl 30 Nov 2002 17:40:18 -0000 1.11 @@ -11,12 +11,13 @@ namespace eval notification::sweep { ad_proc -public schedule_all {} { - This schedules all the notification procs + This schedules all the notification procs. + DEPRECATED. } { } ad_proc -public cleanup_notifications {} { - Clean up the notifications that are done + Clean up the notifications that have been sent out. } { # Get the list of the ones to kill set notification_id_list [db_list select_notification_ids {}] Index: openacs-4/packages/notifications/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/index.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/www/index.tcl 30 Nov 2002 17:40:36 -0000 1.2 @@ -0,0 +1 @@ +ad_returnredirect manage Index: openacs-4/packages/notifications/www/manage-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/manage-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/notifications/www/manage-postgresql.xql 20 Sep 2002 21:19:01 -0000 1.1 +++ openacs-4/packages/notifications/www/manage-postgresql.xql 30 Nov 2002 17:40:36 -0000 1.2 @@ -9,28 +9,8 @@ (select pretty_name from notification_types where notification_types.type_id = - notification_requests.type_id) as type, - case when (select short_name - from notification_types - where notification_types.type_id = - notification_requests.type_id) = 'forums_forum_notif' - then - (select name - from forums_forums - where forum_id = - notification_requests.object_id) - when (select short_name - from notification_types - where notification_types.type_id = - notification_requests.type_id) = 'forums_message_notif' - then - (select subject - from forums_messages - where message_id = - notification_requests.object_id) - else - acs_object__name(notification_requests.object_id) - end as object_name, + notification_requests.type_id) as type, + acs_object__name(notification_requests.object_id) as object_name, (select name from notification_intervals where notification_intervals.interval_id = Index: openacs-4/packages/openfts-driver/openfts-driver.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/openfts-driver.info,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/openfts-driver/openfts-driver.info 23 Sep 2002 23:32:23 -0000 1.4 +++ openacs-4/packages/openfts-driver/openfts-driver.info 30 Nov 2002 17:40:53 -0000 1.5 @@ -37,7 +37,7 @@ - +
    Index: openacs-4/packages/openfts-driver/sql/postgresql/load.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/sql/postgresql/Attic/load.sql,v diff -u -N --- openacs-4/packages/openfts-driver/sql/postgresql/load.sql 15 Sep 2001 21:57:00 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,2 +0,0 @@ -\i /usr/local/src/postgresql-7.1.3/contrib/intarray/_int.sql -\i /usr/local/src/Search-OpenFTS-tcl-0.2/func_pgsql/create_func.sql Index: openacs-4/packages/openfts-driver/tcl/openfts-driver-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/tcl/openfts-driver-init.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/openfts-driver/tcl/openfts-driver-init.tcl 1 Sep 2001 20:33:52 -0000 1.1 +++ openacs-4/packages/openfts-driver/tcl/openfts-driver-init.tcl 30 Nov 2002 17:41:28 -0000 1.2 @@ -9,8 +9,8 @@ if { [llength $files] == 0 } { error "Unable to locate $openfts_tcl_src_path." } - + ns_log Notice "sourcing files from ${openfts_tcl_src_path}" foreach file [lsort $files] { source $file } -} \ No newline at end of file +} Index: openacs-4/packages/openfts-driver/tcl/openfts-driver-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/tcl/openfts-driver-procs.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/openfts-driver/tcl/openfts-driver-procs.tcl 13 Sep 2002 11:10:34 -0000 1.4 +++ openacs-4/packages/openfts-driver/tcl/openfts-driver-procs.tcl 30 Nov 2002 17:41:28 -0000 1.5 @@ -23,17 +23,16 @@ array set self [Search::OpenFTS::new ofts] if ![array size self] { + Search::OpenFTS::DESTROY error "Search failed." + return } set opt(rejected) [list] - if { ![info exists opt(txttid)] || [string equal $opt(txttid) ""] } { - set opt(txttid) $self(TXTTID) - } + foreach {out condition order} [Search::OpenFTS::get_sql self $query opt] break - foreach {out tables condition order} [Search::OpenFTS::get_sql self $query opt] break - + set result(stopwords) $opt(rejected) if { ![string length $condition] } { return [array get result] } @@ -42,17 +41,12 @@ } else { set order "" } - if { ![info exists tables] } { - set tables "" - } if { [info exists out] && [string length $out] > 0 } { set out ",\n $out" } else { set out "" } - set txttbl [split $opt(txttid) .] - set date_range_condition "" if { $df != "" } { append date_range_condition "'$df' <= last_modified and" @@ -64,20 +58,20 @@ set permission_check_enabled_p [ad_parameter -package_id [apm_package_id_from_key openfts-driver] permission_check_enabled_p] set permission_check_condition "" if { $permission_check_enabled_p } { - append permission_check_condition "and acs_permission__permission_p( $opt(txttid), $user_id, 'read') = 't'" + append permission_check_condition "and acs_permission__permission_p( $self(TXTID), $user_id, 'read') = 't'" } set sql_count " select count(*) - from [lindex $txttbl 0]$tables + from $self(TABLE) where $date_range_condition $condition $permission_check_condition" set sql_sort " - select $opt(txttid) as object_id$out - from [lindex $txttbl 0]$tables + select $self(TXTID) as object_id$out + from $self(TABLE) where $date_range_condition $condition @@ -86,11 +80,12 @@ limit $limit offset $offset" - set result(stopwords) $opt(rejected) set result(count) [db_exec_plsql sql_count $sql_count] if { $result(count) > 0} { db_foreach sql_sort $sql_sort {lappend result(ids) $object_id} } + Search::OpenFTS::DESTROY + return [array get result] } @@ -115,7 +110,8 @@ array set idx [Search::OpenFTS::Index::new] Search::OpenFTS::Index::index idx $tid $txt $title - + Search::OpenFTS::DESTROY + return } @@ -130,6 +126,7 @@ array set idx [Search::OpenFTS::Index::new] Search::OpenFTS::Index::delete idx $tid + Search::OpenFTS::DESTROY return } @@ -147,6 +144,7 @@ openfts_driver__unindex $tid openfts_driver__index $tid $txt $title $keywords + Search::OpenFTS::DESTROY return } @@ -175,8 +173,10 @@ array set fts [Search::OpenFTS::new ofts] - return [Search::OpenFTS::get_headline fts opts] + set summary [Search::OpenFTS::get_headline fts opts] + Search::OpenFTS::DESTROY + return $summary } Index: openacs-4/packages/openfts-driver/www/admin/destroy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/admin/destroy.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/openfts-driver/www/admin/destroy.tcl 5 Sep 2002 11:21:38 -0000 1.3 +++ openacs-4/packages/openfts-driver/www/admin/destroy.tcl 30 Nov 2002 17:41:39 -0000 1.4 @@ -1,37 +1,17 @@ -catch { - set ngroups [db_exec_plsql get_ngroups "select mod from fts_conf where did = -2"] - set table_name [lindex [split [db_exec_plsql get_txttid "select mod from fts_conf where did = -1"] .] 0] -} + +set PREFIX "" +array set idx [Search::OpenFTS::Index::new $PREFIX] +Search::OpenFTS::Index::drop idx catch { - db_dml drop_fts_conf "drop table fts_conf;" + db_dml drop_table "drop table $idx(TABLE)" } - - catch { - db_dml drop_trigger "drop trigger ${table_name}_utrg;" + db_dml drop_function "drop function $idx(TABLE)_utrg ()" } - catch { - db_dml drop_function "drop function ${table_name}_utrg ();" -} - -catch { - db_dml drop_table "drop table ${table_name};" -} - -catch { - for { set __i 1 } { $__i <= $ngroups } { incr __i } { - db_dml drop_index "drop table index${__i};" - } -} - -catch { db_dml drop_fts_unknown_lexem "drop table fts_unknown_lexem;" } -catch { - db_dml drop_s_fts_unknown_lexem "drop sequence s_fts_unknown_lexem;" -} -ad_returnredirect "./" \ No newline at end of file +ad_returnredirect "./" Index: openacs-4/packages/openfts-driver/www/admin/initialize-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/admin/initialize-2.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/openfts-driver/www/admin/initialize-2.tcl 5 Sep 2002 11:21:38 -0000 1.3 +++ openacs-4/packages/openfts-driver/www/admin/initialize-2.tcl 30 Nov 2002 17:41:39 -0000 1.4 @@ -8,41 +8,44 @@ table_name table_id dict - parser numbergroup ignore_headline ignore_id_index map use_index_table - use_index_array } -array set opt " -txttid ${table_name}.${table_id} -numbergroup $numbergroup -parser $parser -use_index_array $use_index_array -use_index_table $use_index_table -dict [list $dict] -map [list $map] -ignore_id_index [list $ignore_id_index] -ignore_headline [list $ignore_headline] -" +set DICT_UNKNOWN_LEXEM_TABLE "fts_unknown_lexem" +if [catch { + db_dml create_table "create table $table_name ( ${table_id} int not null primary key, path varchar unique, fts_index txtidx, last_modified timestamp );" +} err] { + error "$err" + return +} +set dat " + txttid ${table_name}.${table_id} + use_index_table $use_index_table + txtidx_field fts_index + numbergroup $numbergroup + ignore_id_index [list $ignore_id_index] + ignore_headline [list $ignore_headline] + map [list $map] + dict [list $dict]" +ns_log Notice "dat = $dat" +array set opt $dat + + + array set idx [Search::OpenFTS::Index::init opt] if {[array size idx] == 0} { error "QQQ: Init failed" - exit + return } -db_dml create_table "create table $table_name ( \ - $table_id int not null primary key, \ - $use_index_array int\[\], \ - last_modified timestamp default now() not null);" - db_dml create_function "create function ${table_name}_utrg () returns opaque as ' \ begin \ new.last_modified := now(); \ @@ -53,7 +56,7 @@ for each row execute procedure ${table_name}_utrg ();" - Search::OpenFTS::Index::create_index idx +Search::OpenFTS::DESTROY ad_returnredirect "./" Index: openacs-4/packages/openfts-driver/www/admin/initialize.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/admin/initialize.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/openfts-driver/www/admin/initialize.tcl 5 Sep 2002 11:21:38 -0000 1.2 +++ openacs-4/packages/openfts-driver/www/admin/initialize.tcl 30 Nov 2002 17:41:39 -0000 1.3 @@ -24,17 +24,12 @@ template::element create openfts_init_form dict \ -html "size 40" \ -label "Dictionaries" \ - -value "Search::OpenFTS::Dict::PorterEng Search::OpenFTS::Dict::UnknownDict" + -value "Search::OpenFTS::Dict::PorterEng {mod Search::OpenFTS::Dict::UnknownDict param {table fts_unknown_lexem}}" -template::element create openfts_init_form parser \ - -html "size 40" \ - -label "Parser" \ - -value Search::OpenFTS::Parser - template::element create openfts_init_form numbergroup \ -html "size 40" \ -label "Number of index tables" \ - -value 13 + -value 10 template::element create openfts_init_form ignore_headline \ -html "size 40" \ @@ -56,9 +51,9 @@ -label "use_index_table" \ -value 1 -template::element create openfts_init_form use_index_array \ +template::element create openfts_init_form txtidx_field \ -html "size 40" \ - -label "use_index_array" \ + -label "txtidx_field" \ -value fts_index template::element create openfts_init_form submit \ Index: openacs-4/packages/openfts-driver/www/doc/INSTALL =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/openfts-driver/www/doc/INSTALL,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/openfts-driver/www/doc/INSTALL 15 Sep 2001 21:31:50 -0000 1.3 +++ openacs-4/packages/openfts-driver/www/doc/INSTALL 30 Nov 2002 17:41:50 -0000 1.4 @@ -1,13 +1,11 @@ -Last updated: September 12, 2001 +Last updated: Oct 11, 2002 Maintainer: Neophytos Demetriou (k2pts@cytanet.com.cy) - Make sure you have installed all headers (for example, spi.h) using "gmake install-all-headers" during the PostgreSQL installation. - If you have not installed intarray, please do so now. intarray - is under the contrib directory of the PostgreSQL source code. -- Download Search-OpenFTS-tcl-0.2.tar.gz from http://openfts.sourceforge.net/ - and save it to /tmp/Search-OpenFTS-tcl-0.2.tar.gz +- Download Search-OpenFTS-tcl-0.3.1.tar.gz from http://openfts.sourceforge.net/ + and save it to /tmp/Search-OpenFTS-tcl-0.3.1.tar.gz - Log in as the root user: @@ -16,33 +14,13 @@ - Untar the archive file: cd /usr/local/src - tar -xzvf /tmp/Search-OpenFTS-tcl-0.2.tar.gz + tar -xzvf /tmp/Search-OpenFTS-tcl-0.3.1.tar.gz - Install the OpenFTS AOLServer module: - chown -R nsadmin.web Search-OpenFTS-tcl-0.2/ - cd Search-OpenFTS-tcl-0.2/ - ./configure --with-aolserver-src=AOLSERVER_SRC_DIR - make - cd aolserver - make - cp nsfts.so AOLSERVER_BIN_DIR - -- Edit nsd.tcl file and add entry for nsfts module: + Follow the directions in Search-OpenFTS-tcl-0.3.1/AOLSERVER.INSTALL - ns_param nssock ${bindir}/nssock.so - ns_param nslog ${bindir}/nslog.so - ... - ns_param nsfts ${bindir}/nsfts.so - - - -- Load intarray and func_pgsql - - Edit load.sql under the openfts-driver/sql/postgresql directory. - psql -f load.sql your-database-name - - Install and mount the openfts-driver package - Restart AOLserver Index: openacs-4/packages/payment-gateway/payment-gateway.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/payment-gateway/payment-gateway.info,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/payment-gateway/payment-gateway.info 19 Sep 2002 20:02:42 -0000 1.3 +++ openacs-4/packages/payment-gateway/payment-gateway.info 30 Nov 2002 17:42:00 -0000 1.4 @@ -5,7 +5,7 @@ Payment Gateway Payment Gateways f - f + t