Index: openacs-4/packages/bookmarks/sql/oracle/bookmarks-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/sql/oracle/bookmarks-create.sql,v diff -u -r1.5 -r1.5.4.1 --- openacs-4/packages/bookmarks/sql/oracle/bookmarks-create.sql 30 Sep 2003 12:10:03 -0000 1.5 +++ openacs-4/packages/bookmarks/sql/oracle/bookmarks-create.sql 22 May 2004 05:32:13 -0000 1.5.4.1 @@ -342,8 +342,9 @@ ); procedure initialize_in_closed_p ( - viewed_user_id in users.user_id%TYPE, - in_closed_p_id in users.user_id%TYPE + viewed_user_id in users.user_id%TYPE, + in_closed_p_id in users.user_id%TYPE, + package_id in apm_packages.package_id%TYPE ); end bookmark; @@ -724,8 +725,9 @@ procedure initialize_in_closed_p ( - viewed_user_id in users.user_id%TYPE, - in_closed_p_id in users.user_id%TYPE + viewed_user_id in users.user_id%TYPE, + in_closed_p_id in users.user_id%TYPE, + package_id in apm_packages.package_id%TYPE ) is v_count_in_closed_p integer; 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.23 -r1.23.4.1 --- openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql 30 Sep 2003 05:04:47 -0000 1.23 +++ openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql 22 May 2004 05:32:14 -0000 1.23.4.1 @@ -249,7 +249,7 @@ -- We might want to clean up old rows in this table since it could -- easily grow very large in big communities sharing bookmarks actively -- refers to whether a folder is open or closed - closed_p boolean default 'f', + closed_p boolean default 't', creation_date timestamptz, constraint bm_in_closed_p_pk primary key (bookmark_id, in_closed_p_id) @@ -476,7 +476,7 @@ END; ' LANGUAGE 'plpgsql'; - +-- Fix for bug 1491, 1653. This function did not always return the true value of closed_p. CREATE FUNCTION bookmark__get_in_closed_p (integer,integer) RETURNS boolean AS ' DECLARE @@ -485,20 +485,23 @@ v_return_value bm_in_closed_p.in_closed_p%TYPE; v_count integer; BEGIN + SELECT count(*) INTO v_count + FROM bm_in_closed_p + WHERE bookmark_id = p_new_parent_id + AND in_closed_p_id = p_user_id; - select (case when count(*) = 0 then FALSE else TRUE end) into - v_return_value from - bm_in_closed_p bic - right join - ( - select bm.bookmark_id from - bm_bookmarks bm, bm_bookmarks bm2 - where bm2.bookmark_id = p_new_parent_id - and bm.tree_sortkey between bm2.tree_sortkey and tree_right(bm2.tree_sortkey) - ) - bm on (bm.bookmark_id = bic.bookmark_id) - where bic.closed_p = TRUE - and bic.in_closed_p_id = p_user_id; + IF v_count > 0 THEN + SELECT closed_p INTO v_return_value + FROM bm_in_closed_p + WHERE bookmark_id = p_new_parent_id + AND in_closed_p_id = p_user_id; + ELSE + -- This needs to match the default closed_p value from + -- bookmark__initialize_in_closed_p (which is TRUE for all + -- except the root folder itself). + v_return_value := TRUE; + END IF; + return v_return_value; END; ' LANGUAGE 'plpgsql'; @@ -775,33 +778,68 @@ END; ' LANGUAGE 'plpgsql'; -CREATE FUNCTION bookmark__initialize_in_closed_p (integer, integer) + +CREATE FUNCTION bookmark__initialize_in_closed_p (integer, integer, integer) RETURNS integer AS ' DECLARE - p_viewed_user_id ALIAS FOR $1; -- in users.user_id%TYPE, - p_in_closed_p_id ALIAS FOR $2; -- in users.user_id%TYPE - v_count_in_closed_p integer; - v_count_bookmarks integer; - c_bookmark_ids RECORD; + p_viewed_user_id ALIAS FOR $1; -- in users.user_id%TYPE, + p_in_closed_p_id ALIAS FOR $2; -- in users.user_id%TYPE + p_package_id ALIAS FOR $3; -- in apm_packages.package_id%TYPE + v_root_id bm_bookmarks.bookmark_id%TYPE; + c_bookmark RECORD; + v_in_closed_p bm_in_closed_p.in_closed_p%TYPE; + v_closed_p bm_in_closed_p.closed_p%TYPE; BEGIN + -- We want to initialize all bookmarks to the closed state, except for + -- the root folder. That means we need to have the following settings + -- based on the tree_level the bookmark/folder is at: + -- bookmark type in_closed_p closed_p tree_level + -- -------------- ----------- -------- ---------- + -- root f f 1 + -- top folders/bm f t 2 + -- all others t t 3+ - FOR c_bookmark_ids IN - SELECT bookmark_id FROM bm_bookmarks - WHERE owner_id = p_viewed_user_id - AND bookmark_id NOT IN - ( - SELECT bookmark_id FROM bm_in_closed_p - WHERE in_closed_p_id = p_in_closed_p_id - ) - LOOP - INSERT INTO bm_in_closed_p (bookmark_id, in_closed_p_id, in_closed_p, creation_date) - VALUES (c_bookmark_ids.bookmark_id, p_in_closed_p_id, ''f'', now()); + -- The bookmarks package can be mounted a number of times, and the same + -- user can have bookmarks at more than one mount point, so we need to + -- pick the right root_folder: + v_root_id := bookmark__get_root_folder(p_package_id, p_viewed_user_id); + + FOR c_bookmark IN + SELECT bookmark_id, tree_level(tree_sortkey) AS t_level FROM bm_bookmarks + WHERE owner_id = p_viewed_user_id + AND bookmark_id IN + ( + -- Select bookmarks that belong to the root of this package_id only + SELECT bm.bookmark_id FROM bm_bookmarks bm, bm_bookmarks bm2 + WHERE bm2.bookmark_id = v_root_id + AND bm.tree_sortkey BETWEEN bm2.tree_sortkey AND tree_right(bm2.tree_sortkey) + ) + AND bookmark_id NOT IN + ( + SELECT bookmark_id FROM bm_in_closed_p + WHERE in_closed_p_id = p_in_closed_p_id + ) + LOOP + IF c_bookmark.t_level = 1 THEN + v_in_closed_p := FALSE; + v_closed_p := FALSE; + ELSIF c_bookmark.t_level = 2 THEN + v_in_closed_p := FALSE; + v_closed_p := TRUE; + ELSE + v_in_closed_p := TRUE; + v_closed_p := TRUE; + END IF; + + INSERT INTO bm_in_closed_p (bookmark_id, in_closed_p_id, in_closed_p, closed_p, creation_date) + VALUES (c_bookmark.bookmark_id, p_in_closed_p_id, v_in_closed_p, v_closed_p, now()); + -- This is not quite right in the case bm_in_closed_p already contains some entries for + -- this p_in_closed_p_id, but it is no worse than what we had before so it will do for now. + -- in_closed_p should really be based on the parent folder state -- and the parent folder + -- must be inserted first. END LOOP; RETURN 0; END; ' LANGUAGE 'plpgsql'; - - - Index: openacs-4/packages/bookmarks/sql/postgresql/bookmarks-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/sql/postgresql/bookmarks-drop.sql,v diff -u -r1.3 -r1.3.4.1 --- openacs-4/packages/bookmarks/sql/postgresql/bookmarks-drop.sql 17 May 2003 10:18:52 -0000 1.3 +++ openacs-4/packages/bookmarks/sql/postgresql/bookmarks-drop.sql 22 May 2004 05:32:14 -0000 1.3.4.1 @@ -14,7 +14,6 @@ -- @cvs-id $Id -- Delete all bookmark objects and corresponding acs objects --- KDK: NB create function inline_3 () returns integer as ' @@ -33,66 +32,25 @@ drop function inline_3 (); --- declare --- cursor c_bookmark_id --- is --- select bookmark_id --- from bm_bookmarks --- where parent_id not in (select bookmark_id from bm_bookmarks); --- begin --- for v_bookmark_id in c_bookmark_id loop --- bookmark.delete(v_bookmark_id.bookmark_id); --- end loop; --- end; --- / --- show errors - --- Drop the in_closed_p table --- KDK: Complete drop table bm_in_closed_p; --- KDK: Complete drop index bm_bookmarks_local_title_idx ; --- KDK: Complete drop index bm_bookmarks_access_date_idx ; --- KDK: Complete drop index bm_bookmarks_idx1; --- KDK: Complete -- drop index bm_bookmarks_idx2; -- Drop bookmark table and package --- KDK: Complete drop table bm_bookmarks; --- Drop functions used to maintain tree_sortkey for CONNECT AS functionality --- KDK: Complete DROP FUNCTION bm_bookmarks_insert_tr (); DROP FUNCTION bm_bookmarks_update_tr (); --- KDK: Complete --- drop package bookmark; --- KDK: For postgres, drop functions separately --- (new, delete, name, get_in_closed_p, update_in_closed_p_one_user, update_in_closed_p_all_users, --- toggle_open_close, toggle_open_close_all, get_root_folder, new_root_folder, private_p, --- update_private_p, initialize_in_closed_p) -DROP FUNCTION bookmark__new (integer,integer,integer,varchar,boolean,integer,timestamptz,integer,varchar,integer); -DROP FUNCTION bookmark__delete (integer); -DROP FUNCTION bookmark__name (integer); -DROP FUNCTION bookmark__get_in_closed_p (integer,integer); -DROP FUNCTION bookmark__update_in_closed_p_one_user (integer, integer); -DROP FUNCTION bookmark__update_in_closed_p_all_users (integer, integer); -DROP FUNCTION bookmark__toggle_open_close (integer, integer); -DROP FUNCTION bookmark__toggle_open_close_all (integer, boolean, integer); -DROP FUNCTION bookmark__new_root_folder (integer, integer); -DROP FUNCTION bookmark__get_root_folder (integer, integer); -DROP FUNCTION bookmark__private_p (integer); -DROP FUNCTION bookmark__update_private_p (integer, boolean); -DROP FUNCTION bookmark__initialize_in_closed_p (integer, integer); + +-- Drop all functions named bookmark__.* +SELECT drop_package('bookmark'); DROP FUNCTION bm_bookmarks_get_tree_sortkey(integer); -- Delete all url objects and corresponding acs objects --- KDK: Complete - create function inline_2 () returns integer as ' DECLARE @@ -110,25 +68,13 @@ drop function inline_2 (); -- Drop url table and package --- KDK: Complete drop table bm_urls; --- KDK: Complete --- drop package url; --- KDK: For postgres, drop functions separately (new, delete, insert_or_update) -DROP FUNCTION url__new(integer,varchar,varchar,varchar,text,text,integer,varchar,integer); -DROP FUNCTION url__delete(integer); -DROP FUNCTION url__insert_or_update(varchar,varchar,varchar,text,text,integer,varchar,integer); +-- Drop all functions named url__.* +SELECT drop_package('url'); --- Drop the url and bookmark object types --- KDK: Complete --- begin --- acs_object_type.drop_type('url'); --- acs_object_type.drop_type('bookmark'); --- end; --- / --- show errors +-- Drop the url and bookmark object types create function inline_0 () returns integer as ' begin Index: openacs-4/packages/bookmarks/tcl/bookmarks-init-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/tcl/bookmarks-init-oracle.xql,v diff -u -r1.2 -r1.2.4.1 --- openacs-4/packages/bookmarks/tcl/bookmarks-init-oracle.xql 25 Sep 2003 17:07:09 -0000 1.2 +++ openacs-4/packages/bookmarks/tcl/bookmarks-init-oracle.xql 22 May 2004 05:32:14 -0000 1.2.4.1 @@ -16,7 +16,7 @@ - delete from bm_in_closed_p where creation_date < (sysdate - 1) + delete from bm_in_closed_p where creation_date < (sysdate - :max_days) Index: openacs-4/packages/bookmarks/tcl/bookmarks-init-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/tcl/bookmarks-init-postgresql.xql,v diff -u -r1.5 -r1.5.4.1 --- openacs-4/packages/bookmarks/tcl/bookmarks-init-postgresql.xql 25 Sep 2003 17:08:22 -0000 1.5 +++ openacs-4/packages/bookmarks/tcl/bookmarks-init-postgresql.xql 22 May 2004 05:32:14 -0000 1.5.4.1 @@ -16,7 +16,7 @@ - delete from bm_in_closed_p where creation_date < (current_timestamp - interval '1 day') + delete from bm_in_closed_p where creation_date < (current_timestamp - interval '$max_days day') Index: openacs-4/packages/bookmarks/tcl/bookmarks-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/tcl/bookmarks-init.tcl,v diff -u -r1.3 -r1.3.4.1 --- openacs-4/packages/bookmarks/tcl/bookmarks-init.tcl 25 Sep 2003 17:07:10 -0000 1.3 +++ openacs-4/packages/bookmarks/tcl/bookmarks-init.tcl 22 May 2004 05:32:14 -0000 1.3.4.1 @@ -27,7 +27,8 @@ to avoid the table growing to large (maximum size of the table would be number_of_bookmarks times number_of_users) } { - db_dml delete_old_in_closed_p "delete from bm_in_closed_p where creation_date < (sysdate - 1)" + set max_days 31 + db_dml delete_old_in_closed_p "delete from bm_in_closed_p where creation_date < (sysdate - :max_days)" } 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.2 -r1.2.10.1 --- openacs-4/packages/bookmarks/tcl/bookmarks-procs-oracle.xql 7 Jun 2001 20:26:06 -0000 1.2 +++ openacs-4/packages/bookmarks/tcl/bookmarks-procs-oracle.xql 22 May 2004 05:32:14 -0000 1.2.10.1 @@ -89,7 +89,7 @@ begin - bookmark.initialize_in_closed_p(:viewed_user_id, :in_closed_p_id); + bookmark.initialize_in_closed_p(:viewed_user_id, :in_closed_p_id, :package_id); end; 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.7 -r1.7.10.1 --- openacs-4/packages/bookmarks/tcl/bookmarks-procs-postgresql.xql 8 Dec 2001 01:17:59 -0000 1.7 +++ openacs-4/packages/bookmarks/tcl/bookmarks-procs-postgresql.xql 22 May 2004 05:32:14 -0000 1.7.10.1 @@ -85,7 +85,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, :package_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.4 -r1.4.8.1 --- openacs-4/packages/bookmarks/tcl/bookmarks-procs.tcl 18 Sep 2002 12:13:16 -0000 1.4 +++ openacs-4/packages/bookmarks/tcl/bookmarks-procs.tcl 22 May 2004 05:32:14 -0000 1.4.8.1 @@ -247,12 +247,12 @@ } -ad_proc bm_initialize_in_closed_p { viewed_user_id in_closed_p_id } { +ad_proc bm_initialize_in_closed_p { viewed_user_id in_closed_p_id package_id} { } { db_exec_plsql initialize_in_closed_p { begin - bookmark.initialize_in_closed_p(:viewed_user_id, :in_closed_p_id); + bookmark.initialize_in_closed_p(:viewed_user_id, :in_closed_p_id, :package_id); end; } } Index: openacs-4/packages/bookmarks/www/bookmark-access.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-access.tcl,v diff -u -r1.2.8.1 -r1.2.8.2 --- openacs-4/packages/bookmarks/www/bookmark-access.tcl 6 May 2004 05:11:58 -0000 1.2.8.1 +++ openacs-4/packages/bookmarks/www/bookmark-access.tcl 22 May 2004 05:32:14 -0000 1.2.8.2 @@ -24,4 +24,4 @@ start with bookmark_id = (select parent_id from bm_bookmarks where bookmark_id = :bookmark_id) connect by prior parent_id = bookmark_id)" -ad_returnredirect "[ad_html_to_text $url]" +ad_returnredirect "$url" Index: openacs-4/packages/bookmarks/www/bookmark-add-one-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-add-one-2.tcl,v diff -u -r1.4 -r1.4.8.1 --- openacs-4/packages/bookmarks/www/bookmark-add-one-2.tcl 10 Sep 2002 22:22:26 -0000 1.4 +++ openacs-4/packages/bookmarks/www/bookmark-add-one-2.tcl 22 May 2004 05:32:14 -0000 1.4.8.1 @@ -36,7 +36,7 @@ set host_url [bm_host_url $complete_url] -# Check if the input url is allreay in the database. If the url is allready in the database +# Check if the input url is already in the database. If the url is already in the database # we fetch the corresponding url_id, and if not we insert the url remembering the url_id. #------------------------------------------------------------------------------------------ set n_complete_urls [db_string count_url " Index: openacs-4/packages/bookmarks/www/bookmark-header.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-header.tcl,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/bookmarks/www/bookmark-header.tcl 6 Feb 2004 08:11:49 -0000 1.1 +++ openacs-4/packages/bookmarks/www/bookmark-header.tcl 22 May 2004 05:32:14 -0000 1.1.2.1 @@ -38,6 +38,7 @@ return_url_urlenc:onevalue } +set package_id [ad_conn package_id] set browsing_user_id [ad_conn user_id] # Is the user viewing his own bookmarks? @@ -47,28 +48,11 @@ set context {} } -set this_url_urlenc [ad_urlencode [ad_conn url]] - - -# To enable non-registered users to view registered users bookmarks (if they have -# permission) we use the session_id of these users as the id in the bm_in_closed_p -# table -set in_closed_p_id [ad_decode $browsing_user_id "0" [ad_conn session_id] $browsing_user_id] - - -# In case this is the first time the user views this bookmark tree -# we need to populate the table keeping track of which bookmarks are in -# closed folders -bm_initialize_in_closed_p $viewed_user_id $in_closed_p_id - # When we are adding a bookmark we need to know which url to return to # A bookmark can also be added via a Bookmarklet in which case return url # will be the page that the user is browsing. set return_url_urlenc [ad_urlencode [ad_conn url]?[export_url_vars viewed_user_id]] -set user_name [db_string user_name "select first_names || ' ' || last_name from cc_users where object_id = :viewed_user_id" -bind "viewed_user_id $viewed_user_id" -default ""] - -set package_id [ad_conn package_id] if { ![string equal $viewed_user_id "0"] } { set root_folder_id [bm_get_root_folder_id [ad_conn package_id] $viewed_user_id] } else { Index: openacs-4/packages/bookmarks/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/index.adp,v diff -u -r1.10 -r1.10.2.1 --- openacs-4/packages/bookmarks/www/index.adp 6 Feb 2004 08:11:49 -0000 1.10 +++ openacs-4/packages/bookmarks/www/index.adp 22 May 2004 05:32:14 -0000 1.10.2.1 @@ -67,7 +67,7 @@ } if {@bookmark.folder_p@ == "f"} { - set url "bookmark-access?bookmark_id=@bookmark.bookmark_id@&url=[ad_urlencode @bookmark.complete_url@]" + set url "bookmark-access?bookmark_id=@bookmark.bookmark_id@&url=[ad_urlencode @bookmark.complete_url;noquote@]" set bgcolor $bookmark_bgcolor set image_url "pics/ftv2doc.gif" lappend action_bar "Details" Index: openacs-4/packages/bookmarks/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/index.tcl,v diff -u -r1.7 -r1.7.4.1 --- openacs-4/packages/bookmarks/www/index.tcl 22 Sep 2003 16:06:18 -0000 1.7 +++ openacs-4/packages/bookmarks/www/index.tcl 22 May 2004 05:32:14 -0000 1.7.4.1 @@ -38,6 +38,8 @@ return_url_urlenc:onevalue } +set package_id [ad_conn package_id] + set browsing_user_id [ad_conn user_id] # Is the user viewing his own bookmarks? @@ -50,16 +52,16 @@ set this_url_urlenc [ad_urlencode [ad_conn url]] -# To enable non-registered users to view registered users bookmarks (if they have -# permission) we use the session_id of these users as the id in the bm_in_closed_p -# table -set in_closed_p_id [ad_decode $browsing_user_id "0" [ad_conn session_id] $browsing_user_id] +# To enable non-registered users to view registered users bookmarks (if they +# have permission) we use the session_id of these users as the id in the +# bm_in_closed_p table. We make the session_id negative so it doesn't collide +# with a valid user_id. +set in_closed_p_id [ad_decode $browsing_user_id "0" -[ad_conn session_id] $browsing_user_id] - # In case this is the first time the user views this bookmark tree # we need to populate the table keeping track of which bookmarks are in # closed folders -bm_initialize_in_closed_p $viewed_user_id $in_closed_p_id +bm_initialize_in_closed_p $viewed_user_id $in_closed_p_id $package_id # When we are adding a bookmark we need to know which url to return to # A bookmark can also be added via a Bookmarklet in which case return url @@ -68,8 +70,6 @@ set user_name [db_string user_name "select first_names || ' ' || last_name from cc_users where object_id = :viewed_user_id" -bind "viewed_user_id $viewed_user_id" -default ""] -set package_id [ad_conn package_id] - set page_title [db_string bookmark_system_name "select acs_object.name(:package_id) from dual"] set context [bm_context_bar_args "" $viewed_user_id] Index: openacs-4/packages/bookmarks/www/toggle-open-close-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/toggle-open-close-oracle.xql,v diff -u -r1.1 -r1.1.10.1 --- openacs-4/packages/bookmarks/www/toggle-open-close-oracle.xql 7 Jun 2001 22:12:52 -0000 1.1 +++ openacs-4/packages/bookmarks/www/toggle-open-close-oracle.xql 22 May 2004 05:32:14 -0000 1.1.10.1 @@ -9,7 +9,7 @@ begin bookmark.toggle_open_close( bookmark_id => :bookmark_id, - browsing_user_id => :browsing_user_id + browsing_user_id => :in_closed_p_id ); end; @@ -21,7 +21,7 @@ begin bookmark.toggle_open_close_all( - browsing_user_id => :browsing_user_id, + browsing_user_id => :in_closed_p_id, closed_p => :closed_p, root_id => bookmark.get_root_folder( package_id => :package_id, Index: openacs-4/packages/bookmarks/www/toggle-open-close-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/toggle-open-close-postgresql.xql,v diff -u -r1.2 -r1.2.10.1 --- openacs-4/packages/bookmarks/www/toggle-open-close-postgresql.xql 26 Jun 2001 00:15:29 -0000 1.2 +++ openacs-4/packages/bookmarks/www/toggle-open-close-postgresql.xql 22 May 2004 05:32:14 -0000 1.2.10.1 @@ -6,7 +6,7 @@ begin - perform bookmark__toggle_open_close (:bookmark_id,:browsing_user_id); + perform bookmark__toggle_open_close (:bookmark_id,:in_closed_p_id); return 0; end; @@ -18,7 +18,7 @@ begin perform bookmark__toggle_open_close_all( - :browsing_user_id, + :in_closed_p_id, :closed_p, bookmark__get_root_folder(:package_id,:viewed_user_id) ); Index: openacs-4/packages/bookmarks/www/toggle-open-close.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/toggle-open-close.tcl,v diff -u -r1.2 -r1.2.8.1 --- openacs-4/packages/bookmarks/www/toggle-open-close.tcl 10 Sep 2002 22:22:26 -0000 1.2 +++ openacs-4/packages/bookmarks/www/toggle-open-close.tcl 22 May 2004 05:32:14 -0000 1.2.8.1 @@ -30,6 +30,9 @@ } set browsing_user_id [ad_conn user_id] +# browsing_user_id == 0 for all unregistered users so we use in_closed_p_id as +# in index.tcl to allow them to open/close folders. +set in_closed_p_id [ad_decode $browsing_user_id "0" -[ad_conn session_id] $browsing_user_id] if { ![empty_string_p $bookmark_id] } { # Toggle one folder @@ -38,7 +41,7 @@ begin bookmark.toggle_open_close( bookmark_id => :bookmark_id, - browsing_user_id => :browsing_user_id + browsing_user_id => :in_closed_p_id ); end;" } elseif { [string equal $action "open_all"] || [string equal $action "close_all"] } { @@ -50,7 +53,7 @@ db_exec_plsql toggle_open_close_all " begin bookmark.toggle_open_close_all( - browsing_user_id => :browsing_user_id, + browsing_user_id => :in_closed_p_id, closed_p => :closed_p, root_id => bookmark.get_root_folder( package_id => :package_id,