Index: openacs-4/packages/bookmarks/bookmarks.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/bookmarks.info,v diff -u -r1.8 -r1.9 --- openacs-4/packages/bookmarks/bookmarks.info 17 Jul 2001 01:52:44 -0000 1.8 +++ openacs-4/packages/bookmarks/bookmarks.info 19 Jul 2001 15:15:26 -0000 1.9 @@ -79,14 +79,22 @@ + + + + + + + + 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.10 -r1.11 --- openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql 17 Jul 2001 01:52:44 -0000 1.10 +++ openacs-4/packages/bookmarks/sql/postgresql/bookmarks-create.sql 19 Jul 2001 15:15:26 -0000 1.11 @@ -337,7 +337,7 @@ else select url_id into v_return_id from bm_urls where bm_urls.complete_url= p_complete_url; return v_return_id; - + end if; END; ' LANGUAGE 'plpgsql'; @@ -405,7 +405,6 @@ END; ' LANGUAGE 'plpgsql'; - CREATE FUNCTION bookmark__delete (integer) RETURNS integer AS ' DECLARE @@ -415,42 +414,17 @@ BEGIN FOR c_bookmark_id_tree IN - select bookmark_id - from bm_bookmarks - where bookmark_id not in - ( - select bookmark_id from bm_bookmarks - where tree_sortkey like - ( - select tree_sortkey || ''%'' - from bm_bookmarks - where bookmark_id = p_bookmark_id - ) - order by tree_sortkey - ) + select bookmark_id, + (select case when count(*)=0 then 1 else 0 end from + bm_bookmarks where parent_id = bm.bookmark_id) as is_leaf_p + from bm_bookmarks bm where tree_sortkey like - ( - select tree_sortkey || ''%'' - from bm_bookmarks - where bookmark_id in - ( - select bookmark_id - from bm_bookmarks bm_outer where not exists - ( - select 1 from bm_bookmarks bm_inner where - bm_outer.bookmark_id = bm_inner.parent_id - ) - intersect - select bookmark_id from bm_bookmarks - where tree_sortkey like - ( - select tree_sortkey || ''%'' - from bm_bookmarks - where bookmark_id = p_bookmark_id - ) - order by tree_sortkey - ) - order by tree_sortkey; + ( + select tree_sortkey || ''%'' + from bm_bookmarks + where bookmark_id = p_bookmark_id + ) + order by tree_level(tree_sortkey) desc, is_leaf_p desc, tree_sortkey LOOP FOR c_bookmark_id_one_level IN select bookmark_id @@ -472,14 +446,12 @@ where bookmark_id = p_bookmark_id ) order by tree_sortkey - ); - - for one_level_bookmark_id in c_bookmark_id_one_level(tree_bookmark_id.bookmark_id) + ) LOOP delete from acs_permissions where object_id = c_bookmark_id_one_level.bookmark_id; delete from bm_in_closed_p where bookmark_id = c_bookmark_id_one_level.bookmark_id; delete from bm_bookmarks where bookmark_id = c_bookmark_id_one_level.bookmark_id; - acs_object__delete(c_bookmark_id_one_level.bookmark_id); + perform acs_object__delete(c_bookmark_id_one_level.bookmark_id); END LOOP; END LOOP; RETURN 0; @@ -592,7 +564,6 @@ ' LANGUAGE 'plpgsql'; - CREATE FUNCTION bookmark__update_in_closed_p_all_users (integer, integer) RETURNS integer AS ' DECLARE @@ -602,19 +573,20 @@ BEGIN FOR c_viewing_in_closed_p_ids IN - select unique in_closed_p_id + select distinct in_closed_p_id from bm_in_closed_p where bookmark_id = (select bookmark_id from bm_bookmarks where bookmark_id = p_bookmark_id) LOOP -- Update the in_closed_p status for this user/session for all bookmarks -- under the folder - update_in_closed_p_one_user (p_bookmark_id, c_viewing_in_closed_p_ids.in_closed_p_id); + perform bookmark__update_in_closed_p_one_user (p_bookmark_id, c_viewing_in_closed_p_ids.in_closed_p_id); END LOOP; RETURN 0; END; ' LANGUAGE 'plpgsql'; + CREATE FUNCTION bookmark__toggle_open_close (integer, integer) RETURNS integer AS ' DECLARE Index: openacs-4/packages/bookmarks/www/bookmark-add-one-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-add-one-2-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-add-one-2-oracle.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,47 @@ + + + + oracle8.1.6 + + + + + begin + :1 := url.new ( + url_id => :url_id, + url_title => :url_title, + host_url => :host_url, + complete_url => :complete_url, + meta_keywords => :meta_keywords, + meta_description => :meta_description, + creation_user => :viewed_user_id, + creation_ip => :creation_ip + ); + end; + + + + + + + + declare + dummy_var integer; + begin + dummy_var := bookmark.new ( + bookmark_id => :bookmark_id, + owner_id => :viewed_user_id, + url_id => :url_id, + local_title => :local_title, + parent_id => :parent_id, + creation_user => :user_id, + creation_ip => :creation_ip + ); + end; + + + + + + + Index: openacs-4/packages/bookmarks/www/bookmark-add-one-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-add-one-2-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-add-one-2-postgresql.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,49 @@ + + + + postgresql7.1 + + + + declare + v_url_id integer; + begin + v_url_id := url__new ( + :url_id, + :url_title, + :host_url, + :complete_url, + :meta_keywords, + :meta_description, + :viewed_user_id, + :creation_ip, + null + ); + return v_url_id; + end; + + + + + + +begin + + perform bookmark__new ( + :bookmark_id, + :viewed_user_id, + :url_id, + :local_title, + FALSE, + :parent_id, + null, + :user_id, + :creation_ip, + null); + return ''; +end; + + + + + Index: openacs-4/packages/bookmarks/www/bookmark-add-one-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-add-one-2.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-add-one-2.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,34 @@ + + + + + + + select count(*) + from bm_urls + where complete_url = :complete_url + + + + + + + select url_id + from bm_urls + where complete_url= :complete_url + + + + + + + update bm_urls set url_title= :url_title, + meta_description= :meta_description, + meta_keywords= :meta_keywords + where url_id = :url_id + + + + + + Index: openacs-4/packages/bookmarks/www/bookmark-edit-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-edit-2-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-edit-2-oracle.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,35 @@ + + + + oracle8.1.6 + + + + + begin + :1 := url.insert_or_update ( + url_title => :local_title, + host_url => :host_url, + complete_url => :complete_url, + creation_user => :creation_user, + creation_ip => :creation_ip + ); + end; + + + + + + + +begin +bookmark.update_in_closed_p_all_users ( + bookmark_id => :bookmark_id, + new_parent_id => :parent_id +); +end; + + + + + Index: openacs-4/packages/bookmarks/www/bookmark-edit-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-edit-2-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-edit-2-postgresql.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,45 @@ + + + + postgresql7.1 + + + + declare + v_url_id integer; + begin + v_url_id := url__insert_or_update ( + :local_title, + :host_url, + :complete_url, + null, + null, + :creation_user, + :creation_ip, + null + ); + return v_url_id; + end; + + + + + + + +begin + +perform bookmark__update_in_closed_p_all_users ( + :bookmark_id, + :parent_id +); +return 0; +end; + + + + + + + + Index: openacs-4/packages/bookmarks/www/bookmark-edit-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-edit-2.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-edit-2.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,20 @@ + + + + + + update bm_bookmarks set local_title = :local_title, parent_id = :parent_id + $url_clause + where bookmark_id = :bookmark_id + + + + + + + update acs_objects set context_id = :parent_id where object_id = :bookmark_id + + + + + Index: openacs-4/packages/bookmarks/www/bookmark-edit-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-edit-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-edit-oracle.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,8 @@ + + + + oracle8.1.6 + + + + Index: openacs-4/packages/bookmarks/www/bookmark-edit-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-edit-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-edit-postgresql.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,15 @@ + + + + postgresql7.1 + + + + select + acs_permission__permission_p(:bookmark_id, :browsing_user_id, 'admin') + + + + + + Index: openacs-4/packages/bookmarks/www/bookmark-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-edit.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bookmarks/www/bookmark-edit.tcl 20 Apr 2001 20:51:09 -0000 1.1 +++ openacs-4/packages/bookmarks/www/bookmark-edit.tcl 19 Jul 2001 15:15:26 -0000 1.2 @@ -81,7 +81,7 @@ } -template::query bookmark onerow "select local_title, +template::query bookmark_edit bookmark onerow "select local_title, owner_id, complete_url, folder_p, Index: openacs-4/packages/bookmarks/www/bookmark-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-edit.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-edit.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,40 @@ + + + + + + select + acs_permission.permission_p(:bookmark_id, :browsing_user_id, 'admin') + from dual + + + + + + select folder_p from bm_bookmarks where bookmark_id = :bookmark_id + + + + + + select security_inherit_p from acs_objects where object_id = :bookmark_id + + + + + + + select local_title, + owner_id, + complete_url, + folder_p, + parent_id, + bookmark_id + from bm_bookmarks left join bm_urls using (url_id) + where bookmark_id = :bookmark_id + + + + + + Index: openacs-4/packages/bookmarks/www/bookmark-view-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-view-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-view-oracle.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,32 @@ + + + + oracle8.1.6 + + + + select local_title, + email, + owner_id, + complete_url, + bookmark_id, + meta_keywords, + meta_description, + url_title + from bm_bookmarks, + bm_urls, + parties + where bookmark_id = :bookmark_id + and bm_bookmarks.url_id = bm_urls.url_id(+) + and bm_bookmarks.owner_id = parties.party_id + + + + + + + + + + + Index: openacs-4/packages/bookmarks/www/bookmark-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-view.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/bookmarks/www/bookmark-view.tcl 20 Apr 2001 20:51:09 -0000 1.1 +++ openacs-4/packages/bookmarks/www/bookmark-view.tcl 19 Jul 2001 15:15:26 -0000 1.2 @@ -27,7 +27,7 @@ ad_require_permission $bookmark_id read -template::query bookmark onerow "select local_title, +template::query bookmark_view bookmark onerow "select local_title, email, owner_id, complete_url, @@ -42,7 +42,6 @@ and bm_bookmarks.url_id = bm_urls.url_id(+) and bm_bookmarks.owner_id = parties.party_id" - ad_return_template Index: openacs-4/packages/bookmarks/www/bookmark-view.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/bookmark-view.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/bookmarks/www/bookmark-view.xql 19 Jul 2001 15:15:26 -0000 1.1 @@ -0,0 +1,22 @@ + + + + + + select local_title, + email, + owner_id, + complete_url, + bookmark_id, + meta_keywords, + meta_description, + url_title + from bm_bookmarks left join bm_urls using (url_id), parties + where bookmark_id = :bookmark_id + and bm_bookmarks.owner_id = parties.party_id + + + + + + 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.4 -r1.5 --- openacs-4/packages/bookmarks/www/index-postgresql.xql 26 Jun 2001 00:15:29 -0000 1.4 +++ openacs-4/packages/bookmarks/www/index-postgresql.xql 19 Jul 2001 15:15:26 -0000 1.5 @@ -47,7 +47,7 @@ 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 + tree_level(tree_sortkey) as lev, parent_id, tree_sortkey from bm_bookmarks where tree_sortkey like ( @@ -87,10 +87,11 @@ order by tree_sortkey ) and b.bookmark_id <> :root_folder_id -order by ord_num +order by b.tree_sortkey +