Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 2 Apr 2001 05:35:29 -0000 1.8 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 3 Apr 2001 05:01:30 -0000 1.9 @@ -169,7 +169,7 @@ rename__name alias for $2; rename__label alias for $3; rename__description alias for $4; - v_name_already_exists_p integer + v_name_already_exists_p integer; begin if rename__name is not null then @@ -209,7 +209,7 @@ move__folder_id alias for $1; move__target_folder_id alias for $2; v_source_folder_id integer; - v_valid_folders_p integer + v_valid_folders_p integer; begin select @@ -224,7 +224,7 @@ folder_id = move__folder_id; if v_valid_folders_p != 2 then - raise ''-20000: content_folder.move - Not valid folder(s)''; + raise EXCEPTION ''-20000: content_folder.move - Not valid folder(s)''; end if; if move__folder_id = content_item__get_root_folder(null) or Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 2 Apr 2001 23:14:07 -0000 1.8 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 3 Apr 2001 05:01:31 -0000 1.9 @@ -869,12 +869,15 @@ -- an item relative to itself is ../item if v_resolved_root_id = get_path__item_id then - v_path := ''../''; + v_path := ''../'' || v_name; + return v_path; end if; -- loop over the remainder of the absolute path - v_path := v_path || v_name; + -- v_path := v_path || v_name; + v_path = rtrim(v_path,''/''); + for v_rec in select i2.name, i2.parent_id, tree_level(i2.tree_sortkey) as tree_level @@ -883,12 +886,12 @@ where i2.parent_id <> 0 and - i1.item_id = v_item_id + i1.item_id = get_path__item_id and i2.tree_sortkey <= i1.tree_sortkey and i1.tree_sortkey like (i2.tree_sortkey || ''%'') - order by i2.tree_sortkey desc + order by i2.tree_sortkey LOOP v_path := v_path || ''/'' || v_rec.name; @@ -917,7 +920,7 @@ and i1.tree_sortkey like (i2.tree_sortkey || ''%'') order by - tree_level desc + tree_level LOOP v_path := v_path || ''/'' || v_rec.name; end loop; @@ -1314,7 +1317,9 @@ begin if content_folder__is_folder(move__item_id) = ''t'' then - content_folder__move(move__item_id, move__target_folder_id); + + PERFORM content_folder__move(move__item_id, move__target_folder_id); + else if content_folder__is_folder(move__target_folder_id) = ''t'' then Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql 2 Apr 2001 05:35:29 -0000 1.4 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql 3 Apr 2001 05:01:31 -0000 1.5 @@ -26,13 +26,14 @@ v_symlink_id cr_symlinks.symlink_id%TYPE; v_name cr_items.name%TYPE; v_label cr_symlinks.label%TYPE; + v_ctype varchar; begin -- SOME CHECKS -- -- 1) check that the target is now a symlink if content_symlink__is_symlink(new__target_id) = ''t'' then - raise EXCEPTION ''-20000: Cannot create a symlink to a symlink %'', target_id; + raise EXCEPTION ''-20000: Cannot create a symlink to a symlink %'', new__target_id; end if; -- 2) check that the parent is a folder @@ -45,19 +46,19 @@ raise EXCEPTION ''-20000: This folder does not allow symlinks to be created''; end if; - -- 4) check that the content folder supports the target item''s content type - if content_folder__is_registered( - parent_id,content_item__get_content_type(new__target_id),''f'') = ''f'' then + -- 4) check that the content folder supports the target items content type + if content_folder__is_registered(new__parent_id, content_item__get_content_type(new__target_id), ''f'') = ''f'' then - raise EXCEPTION ''-20000: This folder does not allow symlinks to items of type % to be created'', '', content_item__get_content_type(new__target_id); + v_ctype := content_item__get_content_type(new__target_id); + raise EXCEPTION ''-20000: This folder does not allow symlinks to items of type % to be created'', v_ctype; end if; -- PASSED ALL CHECKS -- -- Select default name if the name is null if new__name is null then select - ''symlink_to_'' || new__name into v_name + ''symlink_to_'' || name into v_name from cr_items where @@ -79,7 +80,7 @@ v_symlink_id := content_item__new( v_name, - new__parent_id + new__parent_id, new__symlink_id, null, new__creation_date, @@ -124,7 +125,7 @@ -- function is_symlink create function content_symlink__is_symlink (integer) -returns char as ' +returns boolean as ' declare is_symlink__item_id alias for $1; v_symlink_p boolean; Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-test.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-test.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-test.sql 2 Apr 2001 23:14:07 -0000 1.3 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-test.sql 3 Apr 2001 05:01:31 -0000 1.4 @@ -277,7 +277,7 @@ ); PERFORM content_test__put_line(''Get id of item with invalid path - shouldn''''t return anything''); PERFORM content_test__put_line(''Found item at '' || - content_item__get_id(''grandpa/me'', -200,''f'') + coalesce(content_item__get_id(''grandpa/me'', -200,''f'')::varchar,''null'') ); PERFORM content_test__put_line(''Get id of item using subpath''); PERFORM content_test__put_line(''Found item at '' || @@ -307,40 +307,45 @@ content_item__get_path(item_id,folder_b_id) ); -/* + PERFORM content_test__put_line(''-------------------------------------''); PERFORM content_test__put_line(''MOVING/RENAMING CONTENT FOLDERS...''); PERFORM content_test__put_line(''...all tests passed''); PERFORM content_test__put_line(''Moving me from under pa to under grandpa''); PERFORM content_item__move(sub_sub_folder_id, folder_id); PERFORM content_test__put_line(''Path for '' || item_id || '' is '' || - content_item__get_path(item_id) + content_item__get_path(item_id,null) ); - PERFORM content_test__put_line(''Moving grandpa to pa - this should''''nt work''); - PERFORM content_folder__move(folder_id, sub_folder_id); + -- PERFORM content_test__put_line(''Moving grandpa to pa - this shouldn\\\'t work''); + -- PERFORM content_folder__move(folder_id, sub_folder_id); PERFORM content_test__put_line(''Path for '' || item_id || '' is '' || - content_item__get_path(item_id) + content_item__get_path(item_id,null) ); PERFORM content_test__put_line(''Renaming puppy to kitty...''); PERFORM content_item__rename(item_id, ''kitty''); PERFORM content_test__put_line(''Renaming me to aunty...''); - PERFORM content_folder__rename(sub_sub_folder_id, ''aunty''); + PERFORM content_folder__rename(sub_sub_folder_id, ''aunty'',null,null); PERFORM content_test__put_line(''Path for '' || item_id || '' is '' || - content_item__get_path(item_id) + content_item__get_path(item_id,null) ); PERFORM content_test__put_line(''Renaming kitty to pa -- this should work''); PERFORM content_item__rename(item_id, ''pa''); PERFORM content_test__put_line(''Path for '' || item_id || '' is '' || - content_item__get_path(item_id) + content_item__get_path(item_id,null) ); PERFORM content_test__put_line(''-------------------------------------''); PERFORM content_test__put_line(''SYMLINKS...''); PERFORM content_test__put_line(''...all tests passed''); - symlink_a_id := content_symlink__new(''link_a'', + symlink_a_id := content_symlink__new(null, + ''link_a'', sub_sub_folder_id, - sub_folder_id + sub_folder_id, + null, + now(), + null, + null ); PERFORM content_test__put_line(''Create a link in pa to aunty: Symlink is '' || symlink_a_id); @@ -354,7 +359,7 @@ PERFORM content_test__put_line(''Path for symlink '' || symlink_a_id || '' is '' || - content_item__get_path(symlink_a_id) + content_item__get_path(symlink_a_id,null) ); PERFORM content_test__put_line(''Resolving symlink '' || symlink_a_id || @@ -364,7 +369,7 @@ PERFORM content_test__put_line(''Resolved path for symlink '' || symlink_a_id || '' is '' || - content_item__get_path(content_symlink__resolve(symlink_a_id)) + content_item__get_path(content_symlink__resolve(symlink_a_id),null) ); PERFORM content_test__put_line(''Path to item '' || item_id || @@ -386,28 +391,30 @@ ); PERFORM content_test__put_line(''Found item '' || item_id || '' at '' || - content_item__get_id(''/grandpa/aunty/kitty'') + content_item__get_id(''/grandpa/aunty/kitty'',null,''f'') ); PERFORM content_test__put_line(''Found item '' || item_id || '' at '' || - content_item__get_id(''/grandpa/pa/link_a/kitty'') + content_item__get_id(''/grandpa/pa/link_a/kitty'',null,''f'') ); PERFORM content_test__put_line(''Found item '' || item_id || '' starting at aunty '' || sub_sub_folder_id || '' at '' || content_item__get_id(''kitty'', - sub_sub_folder_id + sub_sub_folder_id, + ''f'' ) ); PERFORM content_test__put_line(''Found item '' || item_id || '' starting at symlink '' || symlink_a_id || '' at '' || - content_item__get_id(''kitty'',symlink_a_id) + content_item__get_id(''kitty'',symlink_a_id,''f'') ); PERFORM content_test__put_line(''Found item '' || item_id || '' starting at pa '' || sub_folder_id || '' at '' || content_item__get_id(''link_a/kitty'', - sub_folder_id + sub_folder_id, + ''f'' ) ); @@ -421,15 +428,15 @@ ); PERFORM content_item__move(item_id,folder_b_id); PERFORM content_test__put_line(''Path for item '' || item_id || '' is '' || - content_item__get_path(item_id) + content_item__get_path(item_id,null) ); PERFORM content_test__put_line(''Moving folder '' || folder_b_id || '' to aunty '' || sub_sub_folder_id ); PERFORM content_item__move(folder_b_id,sub_sub_folder_id); PERFORM content_test__put_line(''Path for item '' || item_id || '' is '' || - content_item__get_path(item_id) + content_item__get_path(item_id,null) ); PERFORM content_test__put_line(''--------------------------------''); @@ -445,7 +452,7 @@ PERFORM content_folder__delete(sub_folder_id); PERFORM content_folder__delete(folder_id); PERFORM content_folder__delete(folder_b_id); -*/ + return null; end;' language 'plpgsql';