Index: openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql 3 Jun 2001 04:22:52 -0000 1.3 +++ openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql 5 Jun 2001 01:14:35 -0000 1.4 @@ -122,7 +122,7 @@ select coalesce(max(tree_sortkey),'''') into v_parent_sk from bm_bookmarks - where object_id = new.parent_id; + where parent_id = new.parent_id; end if; @@ -341,13 +341,12 @@ END; ' LANGUAGE 'plpgsql'; - -CREATE FUNCTION bookmark__new (varchar,varchar,varchar,text,text,integer,varchar,integer) +CREATE FUNCTION bookmark__new (integer,integer,integer,varchar,boolean,integer,timestamp,integer,varchar,integer) RETURNS integer AS ' DECLARE p_bookmark_id ALIAS FOR $1; -- in bm_bookmarks.bookmark_id%TYPE, p_owner_id ALIAS FOR $2; -- in bm_bookmarks.owner_id%TYPE, - p_url_id in ALIAS FOR $3; -- bm_urls.url_id%TYPE default null, + p_url_id ALIAS FOR $3; -- in bm_urls.url_id%TYPE default null, p_local_title ALIAS FOR $4; -- in bm_bookmarks.local_title%TYPE default null, p_folder_p ALIAS FOR $5; -- in bm_bookmarks.folder_p%TYPE default f, p_parent_id ALIAS FOR $6; -- in bm_bookmarks.parent_id%TYPE, @@ -389,11 +388,11 @@ select distinct in_closed_p_id from bm_in_closed_p where bookmark_id = (select parent_id from bm_bookmarks - where bookmark_id = v_bookmark_id); + where bookmark_id = v_bookmark_id) LOOP -- For each user or session record the in_closed_p status of -- the bookmark - select bookmark__get_in_closed_p(parent_id, c_viewing_in_closed_p_ids.in_closed_p_id) + select bookmark__get_in_closed_p (p_parent_id, c_viewing_in_closed_p_ids.in_closed_p_id) into v_in_closed_p; insert into bm_in_closed_p (bookmark_id, in_closed_p_id, in_closed_p, creation_date) @@ -698,18 +697,20 @@ v_folder_id bm_bookmarks.bookmark_id%TYPE; v_bookmark_id bm_bookmarks.bookmark_id%TYPE; v_email parties.email%TYPE; + v_local_title bm_bookmarks.local_title%TYPE; BEGIN SELECT acs_object_id_seq.nextval INTO v_bookmark_id FROM dual; - + SELECT email INTO v_email FROM parties where party_id = p_user_id; + v_local_title := '' Bookmarks Root Folder of '' || v_email; v_folder_id := bookmark__new ( v_bookmark_id, p_user_id, null, - '' Bookmarks Root Folder of '' || v_email, + v_local_title, ''t'', p_package_id, null, @@ -719,8 +720,8 @@ -- bookmark_id => v_bookmark_id, -- owner_id => p_user_id, - -- folder_p => ''t'', - -- local_title => '' Bookmarks Root Folder of '' || v_email, + -- folder_p => t, + -- local_title => Bookmarks Root Folder of || v_email, -- parent_id => new_root_folder.package_id -- set up default permissions @@ -734,14 +735,13 @@ -- object_id => v_folder_id, -- grantee_id => new_root_folder.user_id, - -- privilege => ''admin'' + -- privilege => admin RETURN v_folder_id; END; ' LANGUAGE 'plpgsql'; - CREATE FUNCTION bookmark__get_root_folder (integer, integer) RETURNS integer AS ' DECLARE @@ -763,7 +763,7 @@ AND owner_id = p_user_id; ELSE -- must be a new instance. Gotta create a new root folder - v_folder_id := new_root_folder(package_id, user_id); + v_folder_id := bookmark__new_root_folder (p_package_id, p_user_id); END IF; RETURN v_folder_id; @@ -858,7 +858,10 @@ VALUES (c_bookmark_ids.bookmark_id, p_in_closed_p_id, ''f'', now()); END LOOP; - + RETURN 0; END; ' LANGUAGE 'plpgsql'; + + + Index: openacs-4/packages/bookmarks/tcl/bookmarks-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/tcl/bookmarks-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bookmarks/tcl/bookmarks-procs-postgresql.xql 2 Jun 2001 07:33:06 -0000 1.1 +++ openacs-4/packages/bookmarks/tcl/bookmarks-procs-postgresql.xql 5 Jun 2001 01:14:35 -0000 1.2 @@ -29,7 +29,7 @@ - select bookmark__get_root_folder (:package_id, :user_id) + select bookmark__get_root_folder (:package_id, :user_id); @@ -79,7 +79,7 @@ - select bookmark__initialize_in_closed_p (:viewed_user_id, :in_closed_p_id) + select bookmark__initialize_in_closed_p (:viewed_user_id, :in_closed_p_id); Index: openacs-4/packages/bookmarks/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/index-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bookmarks/www/index-oracle.xql 2 Jun 2001 07:33:06 -0000 1.1 +++ openacs-4/packages/bookmarks/www/index-oracle.xql 5 Jun 2001 01:14:35 -0000 1.2 @@ -47,3 +47,9 @@ + + + + + + Index: openacs-4/packages/bookmarks/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/index-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bookmarks/www/index-postgresql.xql 2 Jun 2001 07:33:06 -0000 1.1 +++ openacs-4/packages/bookmarks/www/index-postgresql.xql 5 Jun 2001 01:14:35 -0000 1.2 @@ -24,30 +24,49 @@ coalesce(delete_view.object_id,0) as delete_p, b.lev as indentation $private_select - -from bm_urls u, -(select $index_order bookmark_id, url_id, local_title, folder_p, - tree_level(tree_sortkey) lev, parent_id, 999 ord_num -from bm_bookmarks -where tree_sortkey like -( - select tree_sortkey || ''%'' +from +bm_in_closed_p cross join +((( bm_urls u right join ( + select $index_order bookmark_id, url_id, local_title, folder_p, + tree_level(tree_sortkey) as lev, parent_id, 999 as ord_num from bm_bookmarks - where bookmark_id = :root_folder_id -) -order by tree_sortkey) b left join u on (url_id), -bm_in_closed_p, -(select object_id from acs_object_party_privilege_map - where party_id in (:browsing_user_id, -1) and privilege = 'admin') admin_view right join b -on (admin_view.object_id=b.bookmark_id), -(select object_id from acs_object_party_privilege_map - where party_id in (:browsing_user_id, -1) and privilege = 'delete') delete_view right join b -on (delete_view.object_id = b.bookmark_id) -where -bm_in_closed_p.bookmark_id = b.bookmark_id + where tree_sortkey like + ( + select tree_sortkey || '%' + from bm_bookmarks + where bookmark_id = :root_folder_id + ) + order by tree_sortkey +) +b on (u.url_id=b.url_id)) left join +( + select object_id from acs_object_party_privilege_map + where party_id in (:browsing_user_id, -1) and privilege = 'admin' +) admin_view on (admin_view.object_id=b.bookmark_id)) left join +( + select object_id from acs_object_party_privilege_map + where party_id in (:browsing_user_id, -1) and privilege = 'delete' +) delete_view on (delete_view.object_id = b.bookmark_id)) +where bm_in_closed_p.bookmark_id = b.bookmark_id and bm_in_closed_p.in_closed_p = 'f' and bm_in_closed_p.in_closed_p_id = :in_closed_p_id -and exists (select 1 from bm_bookmarks where exists (select 1 from acs_object_party_privilege_map where object_id = bookmark_id and party_id in (:browsing_user_id, -1) and privilege = 'read') start with bookmark_id = b.bookmark_id connect by prior bookmark_id = parent_id) +and exists +( + select 1 from bm_bookmarks where exists + ( + select 1 from acs_object_party_privilege_map + where object_id = bookmark_id and party_id in + (:browsing_user_id, -1) + and privilege = 'read' + and tree_sortkey like + ( + select tree_sortkey || '%' + from bm_bookmarks + where bookmark_id = '2249' + ) + order by tree_sortkey + ) +) and b.bookmark_id <> :root_folder_id order by ord_num Index: openacs-4/packages/bookmarks/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bookmarks/www/index.tcl 20 Apr 2001 20:51:09 -0000 1.1 +++ openacs-4/packages/bookmarks/www/index.tcl 5 Jun 2001 01:14:35 -0000 1.2 @@ -85,14 +85,17 @@ set bookmarks_admin_p [ad_permission_p $package_id admin] set write_p [bm_user_can_write_in_some_folder_p $viewed_user_id] +# NB: KDK Removing these for now... +# Put switch in for Oracle later... +# NB: KDK This case (creation_date) was already hashed out...do not add back. switch $sort_by { - "name" { - set index_order "/*+INDEX(bm_bookmarks bm_bookmarks_local_title_idx)*/" - } + #"name" { + #set index_order "/*+INDEX(bm_bookmarks bm_bookmarks_local_title_idx)*/" + #} - "access_date" { - set index_order "/*+INDEX_DESC(bm_bookmarks bm_bookmarks_access_date_idx)*/" - } + #"access_date" { + # set index_order "/*+INDEX_DESC(bm_bookmarks bm_bookmarks_access_date_idx)*/" + #} #"creation_date" { #set index_order "/*+INDEX_DESC(bm_bookmarks bm_bookmarks_creation_date_idx)*/" @@ -105,7 +108,7 @@ # We let the owner of the bookmarks see which bookmarks are private if { [string equal $browsing_user_id $viewed_user_id] } { - set private_select ", bookmark.private_p(b.bookmark_id) as private_p" + set private_select ", bookmark__private_p(b.bookmark_id) as private_p" } else { set private_select ", 'f' as private_p" }