Index: openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql,v diff -u -r1.16.2.4 -r1.16.2.5 --- openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql 16 Feb 2003 02:17:06 -0000 1.16.2.4 +++ openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql 18 Feb 2003 01:43:54 -0000 1.16.2.5 @@ -10,10 +10,23 @@ -- TRIGGERS -- -------------- +drop trigger membership_rels_in_tr on membership_rels; +drop function membership_rels_in_tr (); + -- The insert trigger was dummied up in groups-create.sql, so we just need --- to replace the trigger function, not create the trigger +-- to replace the trigger function, not create the trigger. -create or replace function membership_rels_in_tr () returns opaque as ' +-- However, PG 7.3 introduces a new type "trigger" for the return type +-- needed for functions called by triggers. "create function" transmorgifies +-- the return type "opaque" to "trigger" so PG 7.2 dumps can be restored into +-- PG 7.3. But "create or replace" doesn't do it. We can't use "trigger" +-- because we currently are still supporting PG 7.2. Isn't life a pleasure? + +-- I'm leaving the triggers we aren't overriding as "create or replace" because +-- this will be the right thing to do if the PG folks fix this problem or when +-- we drop support of PG 7.2 and no longer need to declare these as type "opaque" + +create function membership_rels_in_tr () returns opaque as ' declare v_object_id_one acs_rels.object_id_one%TYPE; v_object_id_two acs_rels.object_id_two%TYPE; @@ -69,6 +82,9 @@ end;' language 'plpgsql'; +create trigger membership_rels_in_tr after insert on membership_rels +for each row execute procedure membership_rels_in_tr (); + create or replace function membership_rels_up_tr () returns opaque as ' declare map record; Index: openacs-4/packages/acs-tcl/tcl/acs-kernel-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/acs-kernel-procs.xql,v diff -u -r1.2.4.1 -r1.2.4.2 --- openacs-4/packages/acs-tcl/tcl/acs-kernel-procs.xql 11 Feb 2003 17:06:36 -0000 1.2.4.1 +++ openacs-4/packages/acs-tcl/tcl/acs-kernel-procs.xql 18 Feb 2003 01:44:30 -0000 1.2.4.2 @@ -4,26 +4,26 @@ - select 1 as admin_exists_p - from dual - where exists (select 1 - from all_object_party_privilege_map m, users u, acs_magic_objects amo - where m.object_id = amo.object_id + select 1 as admin_exists_p + from dual + where exists (select 1 + from all_object_party_privilege_map m, users u, acs_magic_objects amo + where m.object_id = amo.object_id and amo.name = 'security_context_root' - and m.party_id = u.user_id - and m.privilege = 'admin') + and m.party_id = u.user_id + and m.privilege = 'admin') - select case when count(object_id) = 0 then 0 else 1 end - from site_nodes - where object_id = (select package_id - from apm_packages - where package_key = 'acs-admin') + select case when count(object_id) = 0 then 0 else 1 end + from site_nodes + where object_id = (select package_id + from apm_packages + where package_key = 'acs-admin') Index: openacs-4/packages/file-storage/sql/postgresql/file-storage-views-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/file-storage-views-create.sql,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/file-storage/sql/postgresql/file-storage-views-create.sql 17 Feb 2003 20:31:49 -0000 1.6.2.1 +++ openacs-4/packages/file-storage/sql/postgresql/file-storage-views-create.sql 18 Feb 2003 01:45:06 -0000 1.6.2.2 @@ -29,8 +29,8 @@ from cr_items ci2 where ci2.content_type <> 'content_folder' and ci2.tree_sortkey between ci.tree_sortkey and tree_right(ci.tree_sortkey)) as content_size, - cr_i.parent_id, - cr_i.name as key + ci.parent_id, + ci.name as key from cr_folders, cr_items ci, acs_objects Index: openacs-4/packages/file-storage/tcl/file-storage-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.tcl,v diff -u -r1.25.2.2 -r1.25.2.3 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 17 Feb 2003 20:32:55 -0000 1.25.2.2 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 18 Feb 2003 01:45:42 -0000 1.25.2.3 @@ -316,6 +316,24 @@ return [db_string select_folder {} -default ""] } + ad_proc -public get_folder_objects { + -folder_id:required + -user_id:required + } { + Return a list the object_ids contained by a file storage folder. + + This would be trivial if it weren't for the fact that we need to UNION ALL + with the gawddamned fs_simple_objects Open Force forced upon us and which + will be removed as soon as I (DRB) find the time to write upgrade scripts. + + @param folder_id The folder for which to retrieve contents + @param user_id The viewer of the contents (to make sure they have + permission) + + } { + return [db_list select_folder_contents {}] + } + ad_proc -public get_folder_contents { {-folder_id ""} {-user_id ""} @@ -328,6 +346,8 @@ At minimum the permission checks returned by the code can be removed. Most of the other fields as well. Oh well ... + REMOVE WHEN SYLLABUS IS REWRITTEN TO FIND ITS FILE INTELLIGENTLY + Retrieve the contents of the specified folder in the form of a list of ns_sets, one for each row returned. The keys for each row are as follows: Index: openacs-4/packages/file-storage/tcl/file-storage-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.xql,v diff -u -r1.10.2.1 -r1.10.2.2 --- openacs-4/packages/file-storage/tcl/file-storage-procs.xql 6 Feb 2003 13:00:52 -0000 1.10.2.1 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.xql 18 Feb 2003 01:45:42 -0000 1.10.2.2 @@ -54,6 +54,28 @@ + + + + select * + from (select cr_items.item_id as object_id, + cr_items.name + from cr_items + where cr_items.parent_id = :folder_id + union all + select fs_simple_objects.object_id, + fs_simple_objects.name + from fs_simple_objects + where fs_simple_objects.folder_id = :folder_id) contents + where exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = contents.object_id + and m.party_id = :user_id + and m.privilege = 'read') + + + + select count(*)