Index: openacs-4/packages/acs-content-repository/sql/oracle/content-extlink.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-extlink.sql,v diff -u -N -r1.1.4.1 -r1.1.4.2 --- openacs-4/packages/acs-content-repository/sql/oracle/content-extlink.sql 20 Mar 2003 22:10:27 -0000 1.1.4.1 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-extlink.sql 7 Nov 2003 02:05:36 -0000 1.1.4.2 @@ -105,6 +105,7 @@ target_folder_id in cr_folders.folder_id%TYPE, creation_user in acs_objects.creation_user%TYPE, creation_ip in acs_objects.creation_ip%TYPE default null + name in cr_items.name%TYPE default null ) is v_current_folder_id cr_folders.folder_id%TYPE; v_name cr_items.name%TYPE; @@ -124,20 +125,27 @@ where item_id = copy.extlink_id; - -- can't copy to the same folder - if copy.target_folder_id ^= v_current_folder_id then + if copy.name = '' then + copy.name := NULL; + end if; - select - i.name, e.url, e.label, e.description - into - v_name, v_url, v_label, v_description - from - cr_extlinks e, cr_items i - where - e.extlink_id = i.item_id - and - e.extlink_id = copy.extlink_id; + select + i.name, e.url, e.label, e.description + into + v_name, v_url, v_label, v_description + from + cr_extlinks e, cr_items i + where + e.extlink_id = i.item_id + and + e.extlink_id = copy.extlink_id; + -- can't copy to the same folder + if copy.target_folder_id ^= v_current_folder_id or (v_name != copy.name and copy.name is not null) then + if copy.name is not null then + v_name := copy.name; + end if; + if content_folder.is_registered(copy.target_folder_id, 'content_extlink') = 't' then v_extlink_id := content_extlink.new( Index: openacs-4/packages/acs-content-repository/sql/oracle/content-folder.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-folder.sql,v diff -u -N -r1.1 -r1.1.4.1 --- openacs-4/packages/acs-content-repository/sql/oracle/content-folder.sql 24 Mar 2001 22:00:48 -0000 1.1 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-folder.sql 7 Nov 2003 02:05:36 -0000 1.1.4.1 @@ -241,6 +241,7 @@ target_folder_id in cr_folders.folder_id%TYPE, creation_user in acs_objects.creation_user%TYPE, creation_ip in acs_objects.creation_ip%TYPE default null + name in cr_items.name%TYPE default null ) is v_valid_folders_p integer := 0; v_current_folder_id cr_folders.folder_id%TYPE; @@ -280,12 +281,15 @@ where item_id = copy.folder_id; - if folder_id = content_item.get_root_folder or folder_id = content_template.get_root_folder or target_folder_id = folder_id or v_current_folder_id = target_folder_id then + if copy.name = '' then + copy.name := NULL; + end if; + + if folder_id = content_item.get_root_folder or folder_id = content_template.get_root_folder or target_folder_id = folder_id then v_valid_folders_p := 0; end if; if v_valid_folders_p = 2 then - if is_sub_folder(folder_id, target_folder_id) ^= 't' then -- get the source folder info select @@ -299,6 +303,10 @@ and f.folder_id = copy.folder_id; + if is_sub_folder(folder_id, target_folder_id) ^= 't' or v_current_folder_id != copy.target_folder_id or (v_name != copy.name and copy.name is not null) then then + if copy.name is not null then + v_name := copy.name; + end if; -- create the new folder v_new_folder_id := content_folder.new( parent_id => copy.target_folder_id, Index: openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql,v diff -u -N -r1.10.2.3 -r1.10.2.4 --- openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql 15 Apr 2003 15:27:18 -0000 1.10.2.3 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-item.sql 7 Nov 2003 02:05:36 -0000 1.10.2.4 @@ -1211,11 +1211,12 @@ procedure move ( item_id in cr_items.item_id%TYPE, target_folder_id in cr_folders.folder_id%TYPE + name in cr_items.name%TYPE default null ) is begin if content_folder.is_folder(item_id) = 't' then - content_folder.move(item_id, target_folder_id); + content_folder.move(item_id, target_folder_id, name); elsif content_folder.is_folder(target_folder_id) = 't' then @@ -1227,7 +1228,8 @@ -- update the parent_id for the item update cr_items - set parent_id = move.target_folder_id + set parent_id = move.target_folder_id, + name = nvl (move.name, cr_items.name) where item_id = move.item_id; end if; @@ -1239,13 +1241,14 @@ target_folder_id in cr_folders.folder_id%TYPE, creation_user in acs_objects.creation_user%TYPE, creation_ip in acs_objects.creation_ip%TYPE default null + name in cr_items.name%TYPE default null ) is copy_id cr_items.item_id%TYPE; begin - copy_id := copy2(item_id, target_folder_id, creation_user, creation_ip); + copy_id := copy2(item_id, target_folder_id, creation_user, creation_ip, name); end copy; @@ -1263,6 +1266,7 @@ target_folder_id in cr_folders.folder_id%TYPE, creation_user in acs_objects.creation_user%TYPE, creation_ip in acs_objects.creation_ip%TYPE default null + name in cr_items.name%TYPE default null ) return cr_items.item_id%TYPE is v_current_folder_id cr_folders.folder_id%TYPE; v_num_revisions integer; @@ -1283,23 +1287,26 @@ folder_id => copy2.item_id, target_folder_id => copy2.target_folder_id, creation_user => copy2.creation_user, - creation_ip => copy2.creation_ip + creation_ip => copy2.creation_ip, + name => copy2.name ); -- call content_symlink.copy if the item is a symlink elsif content_symlink.is_symlink(copy2.item_id) = 't' then content_symlink.copy( symlink_id => copy2.item_id, target_folder_id => copy2.target_folder_id, creation_user => copy2.creation_user, - creation_ip => copy2.creation_ip + creation_ip => copy2.creation_ip, + name => copy2.name ); -- call content_extlink.copy if the item is a extlink elsif content_extlink.is_extlink(copy2.item_id) = 't' then content_extlink.copy( extlink_id => copy2.item_id, target_folder_id => copy2.target_folder_id, creation_user => copy2.creation_user, - creation_ip => copy2.creation_ip + creation_ip => copy2.creation_ip, + name => copy2.name ); -- make sure the target folder is really a folder elsif content_folder.is_folder(copy2.target_folder_id) = 't' then @@ -1313,19 +1320,27 @@ where item_id = copy2.item_id; - -- can't copy to the same folder - if copy2.target_folder_id ^= v_current_folder_id then + if copy.name = '' then + copy.name := null; + end if; - select - content_type, name, locale, - nvl(live_revision, latest_revision), storage_type - into - v_content_type, v_name, v_locale, v_revision_id, v_storage_type - from - cr_items - where - item_id = copy2.item_id; + select + content_type, name , locale, + nvl(live_revision, latest_revision), storage_type + into + v_content_type, v_name, v_locale, v_revision_id, v_storage_type + from + cr_items + where + item_id = copy2.item_id; + + -- can't copy to the same folder unless name is different + if copy2.target_folder_id ^= v_current_folder_id or (v_name != copy.name and copy.name is not null) then + + if copy.name is not null then + v_name := copy_name; + end if; -- make sure the content type of the item is registered to the folder v_is_registered := content_folder.is_registered( folder_id => copy2.target_folder_id, Index: openacs-4/packages/acs-content-repository/sql/oracle/content-symlink.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/oracle/content-symlink.sql,v diff -u -N -r1.1 -r1.1.4.1 --- openacs-4/packages/acs-content-repository/sql/oracle/content-symlink.sql 24 Mar 2001 22:00:48 -0000 1.1 +++ openacs-4/packages/acs-content-repository/sql/oracle/content-symlink.sql 7 Nov 2003 02:05:36 -0000 1.1.4.1 @@ -147,6 +147,7 @@ target_folder_id in cr_folders.folder_id%TYPE, creation_user in acs_objects.creation_user%TYPE, creation_ip in acs_objects.creation_ip%TYPE default null + name in cr_items.name%TYPE default null ) is v_current_folder_id cr_folders.folder_id%TYPE; v_name cr_items.name%TYPE; @@ -165,11 +166,9 @@ where item_id = copy.symlink_id; - -- can't copy to the same folder - if copy.target_folder_id ^= v_current_folder_id then select - i.name, content_symlink.resolve(i.item_id), s.label + i.name content_symlink.resolve(i.item_id), s.label into v_name, v_target_id, v_label from @@ -179,7 +178,16 @@ and s.symlink_id = copy.symlink_id; + if copy.name = '' then + copy.name := NULL; + end if; +-- can't copy to the same folder + if copy.target_folder_id ^= v_current_folder_id or (v.name != copy.name and copy.name is not null) then + + if copy.name is not null then + v_name := copy.name; + end if; if content_folder.is_registered(copy.target_folder_id, 'content_symlink') = 't' then if content_folder.is_registered(copy.target_folder_id, Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql,v diff -u -N -r1.7.4.3 -r1.7.4.4 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql 20 Mar 2003 22:11:07 -0000 1.7.4.3 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-extlink.sql 7 Nov 2003 02:05:36 -0000 1.7.4.4 @@ -101,13 +101,43 @@ end;' language 'plpgsql'; -create function content_extlink__copy (integer,integer,integer,varchar) + +create or replace function content_extlink__copy ( + integer, + integer, + integer, + varchar) returns integer as ' declare copy__extlink_id alias for $1; copy__target_folder_id alias for $2; copy__creation_user alias for $3; - copy__creation_ip alias for $4; -- default null + copy__creation_ip alias for $4; -- default null + v_extlink_id cr_extlinks.extlink_id%TYPE; +begin + v_extlink_id := content_extlink__copy ( + copy__extlink_id, + copy__target_folder_id, + copy__creation_user, + copy__creation_ip, + NULL + ); + return v_extlink_id; +end;' language 'plpgsql'; + +create or replace function content_extlink__copy ( + integer, + integer, + integer, + varchar, + varchar) +returns integer as ' +declare + copy__extlink_id alias for $1; + copy__target_folder_id alias for $2; + copy__creation_user alias for $3; + copy__creation_ip alias for $4; -- default null + copy__name alias for $5; v_current_folder_id cr_folders.folder_id%TYPE; v_name cr_items.name%TYPE; v_url cr_extlinks.url%TYPE; @@ -127,24 +157,27 @@ item_id = copy__extlink_id; -- can''t copy to the same folder - if copy__target_folder_id != v_current_folder_id then - select - i.name, e.url, e.description, e.label - into - v_name, v_url, v_description, v_label - from - cr_extlinks e, cr_items i - where - e.extlink_id = i.item_id - and - e.extlink_id = copy__extlink_id; + select + i.name, e.url, e.description, e.label + into + v_name, v_url, v_description, v_label + from + cr_extlinks e, cr_items i + where + e.extlink_id = i.item_id + and + e.extlink_id = copy__extlink_id; + + -- copy to a different folder, or same folder if name + -- is different + if copy__target_folder_id != v_current_folder_id or ( v_name <> copy_name and copy_name is not null ) then if content_folder__is_registered(copy__target_folder_id, ''content_extlink'',''f'') = ''t'' then v_extlink_id := content_extlink__new( - v_name, + coalesce (copy__name, v_name), v_url, v_label, v_description, 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 -N -r1.20.4.2 -r1.20.4.3 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 1 Mar 2003 21:21:20 -0000 1.20.4.2 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-folder.sql 7 Nov 2003 02:05:36 -0000 1.20.4.3 @@ -33,6 +33,8 @@ end;' language 'plpgsql'; -- function new +select define_function_args('content_folder__new','name,label,description,parent_id,context_id,folder_id,creation_date,creation_user,creation_ip'); + create function content_folder__new (varchar,varchar,varchar,integer,integer,integer,timestamptz,integer,varchar) returns integer as ' declare @@ -365,7 +367,33 @@ v_new_folder_id cr_folders.folder_id%TYPE; v_folder_contents_val record; begin + v_new_folder_id := content_folder__copy ( + copy__folder_id, + copy__target_folder_id, + copy__creation_user, + copy_creation_ip, + NULL + ); + return v_new_folder_id; +end;' languagse 'plpgsql'; +create function content_folder__copy (integer,integer,integer,varchar,varchar) +returns integer as ' +declare + copy__folder_id alias for $1; + copy__target_folder_id alias for $2; + copy__creation_user alias for $3; + copy__creation_ip alias for $4; -- default null + copy__name alias for $5; -- default null + v_valid_folders_p integer + v_current_folder_id cr_folders.folder_id%TYPE; + v_name cr_items.name%TYPE; + v_label cr_folders.label%TYPE; + v_description cr_folders.description%TYPE; + v_new_folder_id cr_folders.folder_id%TYPE; + v_folder_contents_val record; +begin + select count(*) into @@ -389,29 +417,28 @@ if copy__folder_id = content_item__get_root_folder(null) or copy__folder_id = content_template__get_root_folder() or copy__target_folder_id = copy__folder_id - or v_current_folder_id = copy__target_folder_id then - v_valid_folders_p := 0; end if; + -- get the source folder info + select + name, label, description + into + v_name, v_label, v_description + from + cr_items i, cr_folders f + where + f.folder_id = i.item_id + and + f.folder_id = copy__folder_id; + if v_valid_folders_p = 2 then - if content_folder__is_sub_folder(copy__folder_id, copy__target_folder_id) != ''t'' then - -- get the source folder info - select - name, label, description - into - v_name, v_label, v_description - from - cr_items i, cr_folders f - where - f.folder_id = i.item_id - and - f.folder_id = copy__folder_id; + if content_folder__is_sub_folder(copy__folder_id, copy__target_folder_id) != ''t'' or v_current_folder_id != copy__target_folder_id or (v_name != copy__name and copy__name is not null) then -- create the new folder v_new_folder_id := content_folder__new( - v_name, + coalesce (copy__name, v_name), v_label, v_description, copy__target_folder_id, 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 -N -r1.39.2.4 -r1.39.2.5 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 20 Mar 2003 22:11:07 -0000 1.39.2.4 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql 7 Nov 2003 02:05:36 -0000 1.39.2.5 @@ -1565,7 +1565,6 @@ return 0; end;' language 'plpgsql'; - create function content_item__set_release_period (integer, timestamptz, timestamptz) returns integer as ' declare @@ -1648,16 +1647,31 @@ -- to the target folder -- 3) update the parent_id for the item -create function content_item__move (integer,integer) +create or replace function content_item__move (integer,integer) returns integer as ' declare move__item_id alias for $1; - move__target_folder_id alias for $2; + move__target_folder_id alias for $2; begin + perform content_item__move( + move__item_id, + move__targer_folder_id, + move__name + ); +return null; +end;' language 'plpgsql'; +create or replace function content_item__move (integer,integer,varchar) +returns integer as ' +declare + move__item_id alias for $1; + move__target_folder_id alias for $2; + move__name alias for $3; +begin + if content_folder__is_folder(move__item_id) = ''t'' then - PERFORM content_folder__move(move__item_id, move__target_folder_id); + PERFORM content_folder__move(move__item_id, move__target_folder_id,move__name); else if content_folder__is_folder(move__target_folder_id) = ''t'' then @@ -1667,10 +1681,14 @@ content_folder__is_registered(move__target_folder_id, content_item__get_content_type(content_symlink__resolve(move__item_id)),''f'') = ''t'' then - -- update the parent_id for the item + if move__name = '''' then + move__name := NULL; + end if; + update cr_items - set parent_id = move__target_folder_id + set parent_id = move__target_folder_id, + name = coalesce(move__name, name) where item_id = move__item_id; end if; @@ -1680,7 +1698,7 @@ end;' language 'plpgsql'; -create function content_item__copy (integer,integer,integer,varchar) +create or replace function content_item__copy (integer,integer,integer,varchar) returns integer as ' declare item_id alias for $1; @@ -1704,7 +1722,7 @@ -- 3) create a new item with no revisions in the target folder -- 4) copy the latest revision from the original item to the new item (if any) -create function content_item__copy2 (integer,integer,integer,varchar) +create or replace function content_item__copy2 (integer,integer,integer,varchar) returns integer as ' declare copy2__item_id alias for $1; @@ -1724,32 +1742,72 @@ v_storage_type cr_items.storage_type%TYPE; begin + perform content_item__copy ( + copy2__item_id, + copy2__target_folder_id, + copy2__creation_user, + copy2__creation_ip, + '''' + ); + return copy2__item_id; + +end;' language 'plpgsql'; + +create or replace function content_item__copy ( + integer, + integer, + integer, + varchar, + varchar +) returns integer as ' +declare + copy__item_id alias for $1; + copy__target_folder_id alias for $2; + copy__creation_user alias for $3; + copy__creation_ip alias for $4; -- default null + copy__name alias for $5; -- default null + v_current_folder_id cr_folders.folder_id%TYPE; + v_num_revisions integer; + v_name cr_items.name%TYPE; + v_content_type cr_items.content_type%TYPE; + v_locale cr_items.locale%TYPE; + v_item_id cr_items.item_id%TYPE; + v_revision_id cr_revisions.revision_id%TYPE; + v_is_registered boolean; + v_old_revision_id cr_revisions.revision_id%TYPE; + v_new_revision_id cr_revisions.revision_id%TYPE; + v_storage_type cr_items.storage_type%TYPE; +begin + -- call content_folder.copy if the item is a folder - if content_folder__is_folder(copy2__item_id) = ''t'' then + if content_folder__is_folder(copy__item_id) = ''t'' then PERFORM content_folder__copy( - copy2__item_id, - copy2__target_folder_id, - copy2__creation_user, - copy2__creation_ip - ); + copy__item_id, + copy__target_folder_id, + copy__creation_user, + copy__creation_ip, + copy__name + ); -- call content_symlink.copy if the item is a symlink - else if content_symlink__is_symlink(copy2__item_id) = ''t'' then + else if content_symlink__is_symlink(copy__item_id) = ''t'' then PERFORM content_symlink__copy( - copy2__item_id, - copy2__target_folder_id, - copy2__creation_user, - copy2__creation_ip + copy__item_id, + copy__target_folder_id, + copy__creation_user, + copy__creation_ip, + copy__name ); -- call content_extlink.copy if the item is an url - else if content_extlink__is_extlink(copy2__item_id) = ''t'' then + else if content_extlink__is_extlink(copy__item_id) = ''t'' then PERFORM content_extlink__copy( - copy2__item_id, - copy2__target_folder_id, - copy2__creation_user, - copy2__creation_ip + copy__item_id, + copy__target_folder_id, + copy__creation_user, + copy__creation_ip, + copy__name ); -- make sure the target folder is really a folder - else if content_folder__is_folder(copy2__target_folder_id) = ''t'' then + else if content_folder__is_folder(copy__target_folder_id) = ''t'' then select parent_id @@ -1758,39 +1816,40 @@ from cr_items where - item_id = copy2__item_id; + item_id = copy__item_id; - -- can''t copy to the same folder - if copy2__target_folder_id != v_current_folder_id then + select + content_type, name, locale, + coalesce(live_revision, latest_revision), storage_type + into + v_content_type, v_name, v_locale, v_revision_id, v_storage_type + from + cr_items + where + item_id = copy__item_id; - select - content_type, name, locale, - coalesce(live_revision, latest_revision), storage_type - into - v_content_type, v_name, v_locale, v_revision_id, v_storage_type - from - cr_items - where - item_id = copy2__item_id; +-- copy to a different folder, or allow copy to the same folder +-- with a different name + if copy__target_folder_id != v_current_folder_id or ( v_name != copy__name and copy__name is not null ) then -- make sure the content type of the item is registered to the folder v_is_registered := content_folder__is_registered( - copy2__target_folder_id, + copy__target_folder_id, v_content_type, ''f'' ); if v_is_registered = ''t'' then -- create the new content item v_item_id := content_item__new( - v_name, - copy2__target_folder_id, + coalesce (copy__name, v_name), + copy__target_folder_id, null, v_locale, now(), - copy2__creation_user, + copy__creation_user, null, - copy2__creation_ip, + copy__creation_ip, ''content_item'', v_content_type, null, @@ -1801,27 +1860,25 @@ v_storage_type ); - -- get the latest revision of the old item - select + select latest_revision into v_old_revision_id from - cr_items + cr_items where - item_id = copy2__item_id; + item_id = copy__item_id; + end if; -- copy the latest revision (if any) to the new item - if v_old_revision_id is not null then + if v_old_revision_id is not null then v_new_revision_id := content_revision__copy ( v_old_revision_id, null, v_item_id, - copy2__creation_user, - copy2__creation_ip + copy__creation_user, + copy__creation_ip ); end if; - end if; - end if; end if; end if; end if; end if; 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 -N -r1.9.4.2 -r1.9.4.3 --- openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql 1 Mar 2003 21:21:20 -0000 1.9.4.2 +++ openacs-4/packages/acs-content-repository/sql/postgresql/content-symlink.sql 7 Nov 2003 02:05:36 -0000 1.9.4.3 @@ -144,14 +144,19 @@ -- procedure copy -create function content_symlink__copy (integer,integer,integer,varchar) -returns integer as ' +create or replace functions content_symlink__copy ( + integer, + integer, + integer, + varchar, + varchar) returns integer as ' declare copy__symlink_id alias for $1; copy__target_folder_id alias for $2; copy__creation_user alias for $3; copy__creation_ip alias for $4; -- default null - v_current_folder_id cr_folders.folder_id%TYPE; + copy__name alias for $5; -- default null +v_current_folder_id cr_folders.folder_id%TYPE; v_name cr_items.name%TYPE; v_target_id cr_items.item_id%TYPE; v_label cr_symlinks.label%TYPE; @@ -168,28 +173,29 @@ where item_id = copy__symlink_id; - -- can''t copy to the same folder - if copy__target_folder_id != v_current_folder_id then + -- can''t copy to the same folder unless name is different - select - i.name, content_symlink__resolve(i.item_id), s.label - into - v_name, v_target_id, v_label - from - cr_symlinks s, cr_items i - where - s.symlink_id = i.item_id - and - s.symlink_id = copy__symlink_id; + select + i.name, content_symlink__resolve(i.item_id), s.label + into + v_name, v_target_id, v_label + from + cr_symlinks s, cr_items i + where + s.symlink_id = i.item_id + and + s.symlink_id = copy__symlink_id; - + -- copy to a different folder, or same folder if name + -- is different + if copy__target_folder_id != v_current_folder_id or ( v_name <> copy_name and copy_name is not null ) then if content_folder__is_registered(copy__target_folder_id, ''content_symlink'',''f'') = ''t'' then if content_folder__is_registered(copy__target_folder_id, content_item__get_content_type(content_symlink__resolve(copy__symlink_id)),''f'') = ''t'' then - v_symlink_id := content_symlink__new( - v_name, + v_symlink_id := content_symlink__new( + coalesce (copy__name,v_name), v_label, v_target_id, copy__target_folder_id, @@ -205,10 +211,33 @@ end if; end if; - return 0; + return v_symlink_id; end;' language 'plpgsql'; +create function content_symlink__copy (integer,integer,integer,varchar) +returns integer as ' +declare + copy__symlink_id alias for $1; + copy__target_folder_id alias for $2; + copy__creation_user alias for $3; + copy__creation_ip alias for $4; -- default null + v_current_folder_id cr_folders.folder_id%TYPE; + v_name cr_items.name%TYPE; + v_target_id cr_items.item_id%TYPE; + v_label cr_symlinks.label%TYPE; + v_symlink_id cr_symlinks.symlink_id%TYPE; +begin + v_symlink_id := content_symlink__copy ( + copy__symlink_id, + copy__target_folder_id, + copy__creation_user, + copy__creation_ip, + NULL + ); + return v_symlink_id; +end;' language 'plpgsql'; + -- function resolve create function content_symlink__resolve (integer) returns integer as '