Index: openacs-4/packages/bookmarks/bookmarks.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/bookmarks.info,v diff -u -r1.4 -r1.5 --- openacs-4/packages/bookmarks/bookmarks.info 2 Jun 2001 07:33:06 -0000 1.4 +++ openacs-4/packages/bookmarks/bookmarks.info 7 Jun 2001 20:26:06 -0000 1.5 @@ -92,6 +92,8 @@ + + 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.4 -r1.5 --- openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql 5 Jun 2001 01:14:35 -0000 1.4 +++ openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql 7 Jun 2001 20:26:06 -0000 1.5 @@ -503,7 +503,7 @@ CREATE FUNCTION bookmark__get_in_closed_p (integer,integer) -RETURNS integer AS ' +RETURNS boolean AS ' DECLARE p_new_parent_id ALIAS FOR $1; -- in bm_bookmarks.bookmark_id%TYPE, p_user_id ALIAS FOR $2; -- in users.user_id%TYPE @@ -513,20 +513,22 @@ select (case when count(*) = 0 then ''f'' else ''t'' end) into v_return_value from - ( - select bookmark_id from bm_bookmarks - where tree_sortkey like + bm_in_closed_p bic + right join ( + select bookmark_id from + bm_bookmarks + where tree_sortkey like + ( select tree_sortkey || ''%'' from bm_bookmarks where bookmark_id = p_new_parent_id - ) - - bm left join bm_in_closed_p bic on (bm.bookmark_id = bic.bookmark_id) - and bic.closed_p = ''t'' - and bic.in_closed_p_id = p_user_id + ) order by tree_sortkey - ) + ) + bm on (bm.bookmark_id = bic.bookmark_id) + and bic.closed_p = ''t'' + and bic.in_closed_p_id = p_user_id; return v_return_value; END; ' LANGUAGE 'plpgsql'; Index: openacs-4/packages/bookmarks/tcl/bookmarks-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/tcl/bookmarks-procs-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bookmarks/tcl/bookmarks-procs-oracle.xql 2 Jun 2001 07:33:06 -0000 1.1 +++ openacs-4/packages/bookmarks/tcl/bookmarks-procs-oracle.xql 7 Jun 2001 20:26:06 -0000 1.2 @@ -3,6 +3,18 @@ oracle8.1.6 + + + and bookmark_id not in + ( + select bookmark_id from bm_bookmarks where folder_p = 't' + and owner_id = :user_id + start with parent_id = :bookmark_id + connect by bookmark_id = parent_id + ) + + + @@ -14,7 +26,7 @@ and owner_id = :user_id and bookmark_id <> :bookmark_id and parent_id <> :package_id - and acs_permission.permission_p(bookmark_id, :user_id, 'write') = 't' + and acs_permission.permission_p(:bookmark_id, :user_id, 'write') = 't' $exclude_folders start with parent_id = :package_id connect by prior bookmark_id = parent_id 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.2 -r1.3 --- openacs-4/packages/bookmarks/tcl/bookmarks-procs-postgresql.xql 5 Jun 2001 01:14:35 -0000 1.2 +++ openacs-4/packages/bookmarks/tcl/bookmarks-procs-postgresql.xql 7 Jun 2001 20:26:06 -0000 1.3 @@ -3,6 +3,26 @@ postgresql7.1 + + + and bookmark_id not in + ( + select bookmark_id from bm_bookmarks + where folder_p = 't' + and owner_id = :user_id + and tree_sortkey like + ( + select tree_sortkey || '%' + from bm_bookmarks + where parent_id = :package_id + ) + order by tree_sortkey + ) + + + + + select bookmark_id, @@ -11,15 +31,15 @@ from bm_bookmarks where tree_sortkey like ( - select tree_sortkey || ''%'' + select tree_sortkey || '%' from bm_bookmarks where parent_id = :package_id ) and folder_p = 't' and owner_id = :user_id and bookmark_id <> :bookmark_id and parent_id <> :package_id - and acs_permission__permission_p(bookmark_id, :user_id, 'write') = 't' + and acs_permission__permission_p(:bookmark_id, :user_id, 'write') = 't' $exclude_folders order by tree_sortkey @@ -50,7 +70,7 @@ select count(*) from bm_bookmarks where tree_sortkey like ( - select tree_sortkey || ''%'' + select tree_sortkey || '%' from bm_bookmarks where bookmark_id = :bookmark_id ) Index: openacs-4/packages/bookmarks/tcl/bookmarks-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/tcl/bookmarks-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bookmarks/tcl/bookmarks-procs.tcl 20 Apr 2001 20:51:09 -0000 1.1 +++ openacs-4/packages/bookmarks/tcl/bookmarks-procs.tcl 7 Jun 2001 20:26:06 -0000 1.2 @@ -21,7 +21,7 @@ } { # We cannot move folders to be their own children if { $folder_p == "t" } { - set exclude_folders "and bookmark_id not in (select bookmark_id from bm_bookmarks where folder_p = 't' and owner_id = :user_id start with parent_id = :bookmark_id connect by bookmark_id = parent_id)" + set exclude_folders [db_map exclude_folders] } else { set exclude_folders "" } Index: openacs-4/packages/bookmarks/www/folder-add-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/folder-add-2-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/folder-add-2-oracle.xql 7 Jun 2001 20:26:06 -0000 1.1 @@ -0,0 +1,26 @@ + + + + oracle8.1.6 + + + + +declare +dummy_var integer; +begin +dummy_var := bookmark.new ( +bookmark_id => :bookmark_id, +owner_id => :viewed_user_id, +local_title => :local_title, +parent_id => :parent_id, +folder_p => :folder_p, +creation_user => :user_id, +creation_ip => :creation_ip +); +end; + + + + + Index: openacs-4/packages/bookmarks/www/folder-add-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/folder-add-2-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/folder-add-2-postgresql.xql 7 Jun 2001 20:26:06 -0000 1.1 @@ -0,0 +1,27 @@ + + + + postgresql7.1 + + + +begin + + perform bookmark__new ( + :bookmark_id, + :viewed_user_id, + null, + :local_title, + :folder_p, + :parent_id, + null, + :user_id, + :creation_ip, + null); + return ''; +end; + + + + + 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.2 -r1.3 --- openacs-4/packages/bookmarks/www/index-oracle.xql 5 Jun 2001 01:14:35 -0000 1.2 +++ openacs-4/packages/bookmarks/www/index-oracle.xql 7 Jun 2001 20:26:06 -0000 1.3 @@ -3,6 +3,25 @@ oracle8.1.6 + + + /*+INDEX(bm_bookmarks bm_bookmarks_local_title_idx)*/ + + + + + + /*+INDEX_DESC(bm_bookmarks bm_bookmarks_access_date_idx)*/ + + + + + + + , bookmark.private_p(b.bookmark_id) as private_p + + + select acs_object.name(:package_id) from dual 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.2 -r1.3 --- openacs-4/packages/bookmarks/www/index-postgresql.xql 5 Jun 2001 01:14:35 -0000 1.2 +++ openacs-4/packages/bookmarks/www/index-postgresql.xql 7 Jun 2001 20:26:06 -0000 1.3 @@ -3,6 +3,25 @@ postgresql7.1 + + + + + + + + + + + + + + + + , bookmark__private_p(b.bookmark_id) as private_p + + + select acs_object__name(:package_id) Index: openacs-4/packages/bookmarks/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/bookmarks/www/index.tcl 5 Jun 2001 01:14:35 -0000 1.2 +++ openacs-4/packages/bookmarks/www/index.tcl 7 Jun 2001 20:26:06 -0000 1.3 @@ -85,17 +85,16 @@ 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. + +# NB: KDK The one 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 [db_map index_order_by_name ] + } - #"access_date" { - # set index_order "/*+INDEX_DESC(bm_bookmarks bm_bookmarks_access_date_idx)*/" - #} + "access_date" { + set index_order [db_map index_order_by_access_date] + } #"creation_date" { #set index_order "/*+INDEX_DESC(bm_bookmarks bm_bookmarks_creation_date_idx)*/" @@ -108,7 +107,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 [db_map private_select] } else { set private_select ", 'f' as private_p" }