Index: openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 27 Apr 2001 17:39:15 -0000 1.2 +++ openacs-4/packages/acs-admin/tcl/apm-admin-procs.tcl 28 Aug 2001 23:51:53 -0000 1.3 @@ -165,9 +165,21 @@ } append widget " " - append widget " - $package(package-name) $package(name) /packages/$package(package.key)/ Index: openacs-4/packages/acs-admin/www/apm/packages-install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/packages-install.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-admin/www/apm/packages-install.tcl 19 Aug 2001 21:26:05 -0000 1.2 +++ openacs-4/packages/acs-admin/www/apm/packages-install.tcl 28 Aug 2001 23:51:53 -0000 1.3 @@ -6,6 +6,7 @@ @cvs-id $Id$ } { + {checked_by_default_p:boolean 1} {install_path [apm_workspace_install_dir]} } @@ -16,31 +17,34 @@ " ### Selection Phase -set spec_files [apm_scan_packages $install_path] +set all_spec_files [apm_scan_packages $install_path] # Nothing in the install dir, maybe they just copied the files in under packages. -if { [empty_string_p $spec_files] } { - set install_path "[acs_root_dir]/packages" - set all_spec_files [apm_scan_packages $install_path] +if { [empty_string_p $all_spec_files] } { + set actual_install_path "[acs_root_dir]/packages" + set all_spec_files [apm_scan_packages $actual_install_path] # We don't need to copy any files, because they are already there. ad_set_client_property apm copy_files_p 0 - # Determine which spec files are new installs; install all of the new items. - foreach spec_file $all_spec_files { - array set version [apm_read_package_info_file $spec_file] - set version_name $version(name) - set package_name $version(package-name) - set package_key $version(package.key) - if { [db_package_supports_rdbms_p $version(database_support)] } { - if { [apm_package_registered_p $package_key] } { - if { [apm_higher_version_installed_p $package_key $version_name] } { - lappend spec_files $spec_file - } - } else { +} else { + ad_set_client_property apm copy_files_p 1 + set actual_install_path $install_path +} + +# Determine which spec files are new installs; install all of the new items. +set spec_files [list] +foreach spec_file $all_spec_files { + array set version [apm_read_package_info_file $spec_file] + set version_name $version(name) + set package_name $version(package-name) + set package_key $version(package.key) + if { [db_package_supports_rdbms_p $version(database_support)] } { + if { [apm_package_registered_p $package_key] } { + if { [apm_higher_version_installed_p $package_key $version_name] } { lappend spec_files $spec_file } + } else { + lappend spec_files $spec_file } } -} else { - ad_set_client_property apm copy_files_p 1 } ns_log Debug $spec_files @@ -71,16 +75,24 @@ If you think you might want to use a package later (but not right away), - install it but don't enable it. - -
+ install it but don't enable it.

" + + if { $checked_by_default_p } { + ns_write "Uncheck all boxes" + } else { + ns_write "Check all boxes" + } + + ns_write "" + # Client properties do not deplete the limited URL variable space. ad_set_client_property apm spec_files $spec_files - ad_set_client_property apm install_path $install_path + ad_set_client_property apm install_path $actual_install_path set errors [list] set pkg_info_list [list] + set pkg_key_list [list] ns_log Debug "APM: Specification files available: $spec_files" foreach spec_file $spec_files { ### Parse the package. @@ -93,10 +105,16 @@ ns_log Debug "APM: Adding $package(package.key) to list for installation." lappend pkg_info_list [pkg_info_new $package(package.key) $spec_file \ $package(provides) $package(requires) ""] + lappend pkg_key_list $package(package.key) } } - set widget [apm_package_selection_widget $pkg_info_list] + if { $checked_by_default_p } { + set widget [apm_package_selection_widget $pkg_info_list $pkg_key_list $pkg_key_list] + } else { + set widget [apm_package_selection_widget $pkg_info_list] + } + if {[empty_string_p $widget]} { ns_write "There are no new packages available.

[ad_footer]" Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-relationships-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-relationships-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-kernel/sql/postgresql/acs-relationships-create.sql 17 Apr 2001 23:41:36 -0000 1.7 +++ openacs-4/packages/acs-kernel/sql/postgresql/acs-relationships-create.sql 28 Aug 2001 23:51:53 -0000 1.8 @@ -81,61 +81,6 @@ '; --- create or replace package acs_rel_type --- as --- --- procedure create_role ( --- role in acs_rel_roles.role%TYPE, --- pretty_name in acs_rel_roles.pretty_name%TYPE default null, --- pretty_plural in acs_rel_roles.pretty_plural%TYPE default null --- ); --- --- procedure drop_role ( --- role in acs_rel_roles.role%TYPE --- ); --- --- function role_pretty_name ( --- role in acs_rel_roles.role%TYPE --- ) return acs_rel_roles.pretty_name%TYPE; --- --- function role_pretty_plural ( --- role in acs_rel_roles.role%TYPE --- ) return acs_rel_roles.pretty_plural%TYPE; --- --- procedure create_type ( --- rel_type in acs_rel_types.rel_type%TYPE, --- pretty_name in acs_object_types.pretty_name%TYPE, --- pretty_plural in acs_object_types.pretty_plural%TYPE, --- supertype in acs_object_types.supertype%TYPE --- default 'relationship', --- table_name in acs_object_types.table_name%TYPE, --- id_column in acs_object_types.id_column%TYPE, --- package_name in acs_object_types.package_name%TYPE, --- abstract_p in acs_object_types.abstract_p%TYPE default 'f', --- type_extension_table in acs_object_types.type_extension_table%TYPE --- default null, --- name_method in acs_object_types.name_method%TYPE default null, --- object_type_one in acs_rel_types.object_type_one%TYPE, --- role_one in acs_rel_types.role_one%TYPE default null, --- min_n_rels_one in acs_rel_types.min_n_rels_one%TYPE, --- max_n_rels_one in acs_rel_types.max_n_rels_one%TYPE, --- object_type_two in acs_rel_types.object_type_two%TYPE, --- role_two in acs_rel_types.role_two%TYPE default null, --- min_n_rels_two in acs_rel_types.min_n_rels_two%TYPE, --- max_n_rels_two in acs_rel_types.max_n_rels_two%TYPE --- ); --- --- procedure drop_type ( --- rel_type in acs_rel_types.rel_type%TYPE, --- cascade_p in char default 'f' --- ); --- --- end acs_rel_type; - --- show errors - --- create or replace package body acs_rel_type --- procedure create_role create function acs_rel_type__create_role (varchar,varchar,varchar) returns integer as ' declare @@ -151,7 +96,16 @@ return 0; end;' language 'plpgsql'; +create function acs_rel_type__create_role (varchar) +returns integer as ' +declare + create_role__role alias for $1; +begin + perform acs_rel_type__create_role(create_role__role, NULL, NULL); + return 0; +end;' language 'plpgsql'; + -- procedure drop_role create function acs_rel_type__drop_role (varchar) returns integer as ' Index: openacs-4/packages/address-book/address-book.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/address-book.info,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/address-book.info 20 Apr 2001 20:51:12 -0000 1.1 +++ openacs-4/packages/address-book/address-book.info 28 Aug 2001 23:51:53 -0000 1.2 @@ -4,6 +4,7 @@ Address Book Address Books + f f @@ -19,7 +20,6 @@ - @@ -28,26 +28,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/address-book/sql/postgresql/address-book-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/sql/postgresql/address-book-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/sql/postgresql/address-book-create.sql 22 Aug 2001 22:55:22 -0000 1.1 +++ openacs-4/packages/address-book/sql/postgresql/address-book-create.sql 28 Aug 2001 23:51:53 -0000 1.2 @@ -1,6 +1,7 @@ -- -- packages/address-book/sql/address-book-create.sql --- @author ported to pg by Rafael Calvo (rafa@sedal.usyd.edu.au) +-- @author ported to pg by Rafael Calvo (rafa@sedal.usyd.edu.au) and +-- Don Baccus (dhogaza@pacifier.com) -- @author jmileham@arsdigita.com -- @creation_date 2000-12-04 -- @cvs-id $Id$ @@ -435,8 +436,8 @@ integer -- ab_contact_attrs.attr_id%TYPE ) returns integer as ' declare - attr_id_one alias for $1; - attr_id_two alias for $2; + p_attr_id_one alias for $1; + p_attr_id_two alias for $2; begin -- The exists clause verifies that the application is trying -- to perform a legal swap (one between two attributes of @@ -445,13 +446,13 @@ update ab_contact_attrs aca1 set sort_key = (select sort_key from ab_contact_attrs aca2 - where aca1.attr_id = decode(aca2.attr_id, - swap_sort.attr_id_one, swap_sort.attr_id_two, - swap_sort.attr_id_two, swap_sort.attr_id_one)) - where attr_id in (swap_sort.attr_id_one, swap_sort.attr_id_two) + where aca1.attr_id = case aca2.attr_id + when p_attr_id_one then p_attr_id_two + when p_attr_id_two then p_attr_id_one) + where attr_id in (p_attr_id_one, p_attr_id_two) and exists (select 1 from ab_contact_attrs aca3, ab_contact_attrs aca4 - where aca3.attr_id = swap_sort.attr_id_one - and aca4.attr_id = swap_sort.attr_id_two + where aca3.attr_id = p_attr_id_one + and aca4.attr_id = p_attr_id_two and aca3.contact_id = aca4.contact_id); end;' language 'plpgsql'; @@ -471,16 +472,11 @@ -- -------------------- -- -- AB_CONTACT_REL -- -- -------------------- --- RC: acs_rel_type is defined in packages/acs-kernel/sql/postgresql/acs-relationships-create.sql --- PERFORM acs_rel_type__create_role(''contact''); --- -- Dont know what to call the object associated with the oontact, --- -- so I wont define a role for it. Should be ok, seeing as the --- -- groups system does this too. - create function inline_0 () returns integer as ' begin +PERFORM acs_rel_type__create_role(''contact''); PERFORM acs_rel_type__create_type ( ''ab_contact_rel'', -- rel_type ''Address Book Contact Relation'', -- pretty_name @@ -681,23 +677,32 @@ end;' language 'plpgsql'; +create function pl_address__orphan_address(integer) returns integer as ' +declare + v_rel_id subplace_rels.rel_id%TYPE; +begin + select sr.rel_id + from subplace_rels sr, acs_rels ar + where ar.rel_id = sr.rel_id and ar.object_id_two = :address_id; + if found then + subplace_rel__delete(v_rel_id); + pl_address__delete(:address_id); +end;' language 'plpgsql'; + + -- function delete create function ab_contact__delete ( - -- contact_id - -- delete_orphan_addresses_p in char default t integer, -- ab_contacts.contact_id%TYPE boolean -- char default t ) returns integer as ' declare contact_id alias for $1; delete_orphan_addresses_p alias for $2; - v_ab_contact_attrs_row ab_contact_attrs%ROWTYPE; - v_addresses_located_row pl_addresses_located%ROWTYPE; + v_ab_contact_attrs_row ab_contact_attrs%ROWTYPE; + v_addresses_located_row pl_addresses_located%ROWTYPE; + v_rel_id ab_contact_rels.rel_id%TYPE; begin - -- RC: Code to find orphans temporarily removed: FIX - -- RC: set delete_orphan_address to false - delete_orphan_addresses_p = ''f''; -- First blow away attributes for v_ab_contact_attrs_row in ( @@ -708,114 +713,41 @@ ab_contact_attr__delete(v_ab_contact_attrs_row.attr_id); end loop; - -- Then iterate through address location relations - -- RC: Missing code that delets address relations-- FIX - - -- If we are deleting orphans then - -- RC: Missing code here. This is buggy and should be completed. - - + for v_addresses_located_row in (select * from pl_addresses_located where locatee_id = ab_contact.delete.contact_id) loop + subplace_rel__delete(v_addresses_located_row.rel_id); + if delete_orphan_addresses_p and + not exists(select 1 + from place_element_map pem, pl_address pl + where pem.place_id = pl.address_id and + v_addresses_located_row.address_id = pl.address_id) + then + select sr.rel_id into v_rel_id + from subplace_rels sr, acs_rels ar + where ar.rel_id = sr.rel_id and ar.object_id_two = v_addresses_located_row.address_id; + if found then + subplace_rel__delete(v_rel_id); + end if; + end if; return 0; end;' language 'plpgsql'; ---create function ab_contact__delete ( --- -- contact_id --- -- delete_orphan_addresses_p in char default --- integer, -- ab_contacts.contact_id%TYPE --- boolean -- char default ---) returns integer as ' ---declare --- contact_id alias for $1; --- delete_orphan_addresses_p alias for $2; --- v_ab_contact_attrs_row ab_contact_attrs%ROWTYPE; --- v_addresses_located_row pl_addresses_located%ROWTYPE; ---begin --- select count(*) = 0 --- into v_address_is_orphan_p --- from place_element_map --- where place_id = v_addresses_located_row.address_id; --- --- v_address_is_orphan_p boolean; --- --- if v_address_is_orphan_p then --- select sr.rel_id --- into v_rel_id --- from subplace_rels sr, acs_rels ar --- where ar.rel_id = sr.rel_id --- and ar.object_id_two = v_addresses_located_row.address_id; --- --- v_rel_id subplace_rels.rel_id%TYPE; --- --- --- -- First blow away attributes --- for v_ab_contact_attrs_row in ( --- select attr_id --- from ab_contact_attrs --- where contact_id = ab_contact.delete.contact_id) --- loop --- ab_contact_attr__delete(v_ab_contact_attrs_row.attr_id); --- end loop; --- --- -- Then iterate through address location relations --- --- for v_addresses_located_row in ( --- select * --- from pl_addresses_located --- where locatee_id = ab_contact.delete.contact_id) --- loop --- --- -- Delete the rel --- subplace_rel__delete(v_addresses_located_row.rel_id); --- --- -- If we're deleting orphans then --- if delete_orphan_addresses_p = 't' then --- --- -- Check if the address is an orphan --- open address_is_orphan_p_cursor(address_id => v_addresses_located_row.address_id); --- fetch address_is_orphan_p_cursor into v_address_is_orphan_p; --- close address_is_orphan_p_cursor; --- if v_address_is_orphan_p = 't' then --- --- -- Delete the address's subplace_relation --- open subplace_rel_cursor(address_id => v_addresses_located_row.address_id); --- fetch subplace_rel_cursor into v_rel_id; --- if not subplace_rel_cursor%NOTFOUND then --- PERFORM subplace_rel.delete(v_rel_id); --- end if; --- close subplace_rel_cursor; --- --- -- Delete the address itself --- PERFORM pl_address__delete(v_addresses_located_row.address_id); --- --- end if; --- --- end if; --- --- --- ---return 0; ---end;' language 'plpgsql'; - - -select * from users; - -- function work_phone create function ab_contact__work_phone ( -- contact_id integer -- ab_contacts.contact_id%TYPE -) return varchar as ' +) returns varchar as ' declare - contact_id_p alias for $1; + p_contact_id alias for $1; v_value ab_contact_attrs.value%TYPE; -- varchar(200) begin select value into v_value from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and sort_key = (select min(sort_key) from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and type_key = ''work_phone''); return v_value; end;' language 'plpgsql'; @@ -824,18 +756,18 @@ create function ab_contact__home_phone ( -- contact_id integer -- ab_contacts.contact_id%TYPE -) return varchar as ' +) returns varchar as ' declare - contact_id_p alias for $1; + p_contact_id alias for $1; v_value ab_contact_attrs.value%TYPE; begin select value into v_value from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and sort_key = (select min(sort_key) from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and type_key = ''home_phone''); return v_value; @@ -845,18 +777,18 @@ create function ab_contact__fax ( -- contact_id integer -- ab_contacts.contact_id%TYPE -) return varchar as ' +) returns varchar as ' declare - contact_id_p alias for $1; + p_contact_id alias for $1; v_value ab_contact_attrs.value%TYPE; begin select value into v_value from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and sort_key = (select min(sort_key) from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and type_key = ''fax''); return v_value; @@ -866,38 +798,38 @@ create function ab_contact__other ( -- contact_id integer -- ab_contacts.contact_id%TYPE -) return varchar as ' +) returns varchar as ' declare - contact_id_p alias for $1; + p_contact_id alias for $1; v_value ab_contact_attrs.value%TYPE; begin select value into v_value from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and sort_key = (select min(sort_key) from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and type_key = ''other''); return v_value; end;' language 'plpgsql'; -- function email -create function ab_contact__fax ( +create function ab_contact__email ( -- contact_id integer -- ab_contacts.contact_id%TYPE -) return varchar as ' +) returns varchar as ' declare - contact_id_p alias for $1; + p_contact_id alias for $1; v_value ab_contact_attrs.value%TYPE; begin select value into v_value from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and sort_key = (select min(sort_key) from ab_contact_attrs - where contact_id = contact_id_p + where contact_id = p_contact_id and type_key = ''email''); return v_value; @@ -909,11 +841,11 @@ create view ab_contacts_complete as select ac.*, - ab_contact__work_phone(contact_id) work_phone, - ab_contact__home_phone(contact_id) home_phone, - ab_contact__fax(contact_id) fax, - ab_contact__other(contact_id) other, - ab_contact__email(contact_id) email + ab_contact__work_phone(contact_id) as work_phone, + ab_contact__home_phone(contact_id) as home_phone, + ab_contact__fax(contact_id) as fax, + ab_contact__other(contact_id) as other, + ab_contact__email(contact_id) as email from ab_contacts ac; -- Index: openacs-4/packages/address-book/sql/postgresql/address-book-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/sql/postgresql/address-book-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/sql/postgresql/address-book-drop.sql 22 Aug 2001 22:55:22 -0000 1.1 +++ openacs-4/packages/address-book/sql/postgresql/address-book-drop.sql 28 Aug 2001 23:51:53 -0000 1.2 @@ -2,6 +2,11 @@ -- @author John Mileham (jmileham@arsdigita.com) -- @cvs-id $Id$ +select ab_contact_attr__delete(attr_id) from ab_contact_attrs; +select ab_contact_rel__delete(rel_id) from ab_contact_rels; +select ab_contact_attr_type__delete(type_id) from ab_contact_attr_types; +select ab_contact__delete(contact_id) from ab_contacts; + drop view ab_contacts_related; drop view ab_contacts_complete; @@ -11,9 +16,6 @@ drop function ab_contact_attr__swap_sort(integer,integer);--RC -drop function ab_contact_attr__delete(); - -drop function ab_contact_attr__delete(); drop function ab_contact_attr_type__new( integer, varchar, @@ -40,100 +42,19 @@ drop function ab_contact__delete(integer, boolean); --- the original loops in Orcle look like: --- declare --- cursor object_id_c is --- select rel_id from ab_contact_rels; --- v_row ab_contact_rels%ROWTYPE; ---begin --- for v_row in object_id_c loop --- ab_contact_rel.delete(v_row.rel_id); --- end loop; ---end; ---/ ---show errors +select acs_rel_type__drop_type('ab_contact_rel'); +select acs_rel_type__drop_role('contact'); +select acs_object_type__drop_type('ab_contact_attr'); -create function inline_0 () returns integer as ' -begin - PERFORM - for attr_id - in select attr_id from ab_contact_attrs - loop - ab_contact_attr__delete(v_row.attr_id); - end loop; - - for rel_id - in select rel_id from ab_contact_rels - loop - ab_contact_rel__delete(v_row.rel_id); - end loop; - - for type_id - in select type_id from ab_contact_attr_types - loop - ab_contact_attr_types__delete(v_row.type_id); - end loop; - - for contact_id - in select contact_id from ab_contacts - loop - ab_contacts__delete(v_row.contact_id); - end loop; -return null; -end;' language 'plpgsql'; -select inline_0 (); -drop function inline_0 (); - - -drop package ab_contact; - -drop package ab_contact_rel; - -drop table ab_contact_rels; - -begin - acs_rel_type__drop_type(''ab_contact_rel''); - acs_rel_type__drop_role(''contact''); -end; -less - -drop package ab_contact_attr; - -drop table ab_contact_attrs; - -create function inline_0 () returns integer as ' -begin - PERFORM acs_object_type__drop_type(''ab_contact_attr''); -returns null; -end;' language 'plpgsql'; -select inline_0 (); -drop function inline_0 (); - - -drop package ab_contact_attr_type; - drop table ab_contact_attr_types; -create function inline_0 () returns integer as ' -begin - PERFORM acs_object_type__drop_type(''ab_contact_attr_type''); -returns null; -end;' language 'plpgsql'; -select inline_0 (); -drop function inline_0 (); +select acs_object_type__drop_type('ab_contact_attr_type'); drop table ab_contacts; +select acs_object_type__drop_type('ab_contact'); -create function inline_0 () returns integer as ' -begin - PERFORM acs_object_type__drop_type(''ab_contact''); -returns null; -end;' language 'plpgsql'; -select inline_0 (); -drop function inline_0 (); - drop function ab_contact_rel__delete(integer); drop function ab_contact_rel__new(integer,integer,integer,integer,varchar,varchar,varchar); Index: openacs-4/packages/address-book/www/address-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/address-delete-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/address-delete-postgresql.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/address-delete-postgresql.xql 28 Aug 2001 23:51:53 -0000 1.2 @@ -5,39 +5,17 @@ - FIX ME PLSQL -FIX ME PLSQL - begin - location_rel__delete(:rel_id); - end; + select location_rel__delete(:rel_id); - FIX ME PLSQL -FIX ME PLSQL - declare - v_rel_id subplace_rels.rel_id%TYPE; - cursor subplace_rel_cursor is - select sr.rel_id - from subplace_rels sr, - acs_rels ar - where ar.rel_id = sr.rel_id - and ar.object_id_two = :address_id; - begin - open subplace_rel_cursor; - fetch subplace_rel_cursor into v_rel_id; - if not subplace_rel_cursor%NOTFOUND then - subplace_rel__delete(v_rel_id); - end if; - close subplace_rel_cursor; - pl_address__delete(:address_id); - end; + select pl_address__delete_orphan_address(:address_id); Index: openacs-4/packages/address-book/www/address-swap-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/address-swap-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/address-swap-postgresql.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/address-swap-postgresql.xql 28 Aug 2001 23:51:54 -0000 1.2 @@ -5,21 +5,23 @@ - FIX ME ROWNUM -select rel_id from (select rel_id from addresses_located where sort_key $operator (select sort_key from location_rels where rel_id = :rel_id) and locatee_id = :contact_id order by sort_key $direction) sq where rownum = 1 + select rel_id + from (select rel_id, sort_key + from addresses_located + where sort_key $operator (select sort_key + from location_rels + where rel_id = :rel_id) and + locatee_id = :contact_id) + order by sort_key $direction sq + limit 1 - FIX ME PLSQL -FIX ME PLSQL - begin - location_rel__swap_sort(rel_id_one => :rel_id, - rel_id_two => :other_rel_id); - end; + select location_rel__swap_sort(rel_id_one => :rel_id, rel_id_two => :other_rel_id); Index: openacs-4/packages/address-book/www/attr-ae-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/attr-ae-2-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/attr-ae-2-postgresql.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/attr-ae-2-postgresql.xql 28 Aug 2001 23:51:54 -0000 1.2 @@ -5,28 +5,19 @@ - FIX ME PLSQL -FIX ME PLSQL - begin - :1 := - ab_contact_attr__new(creation_user => :user_id, - creation_ip => :peeraddr, - context_id => :contact_id, - contact_id => :contact_id, - type_key => :attr_type, - value => :attr_value); - end; + select ab_contact_attr__new(:user_id, :peeraddr, :contact_id, :contact_id, + :attr_type, :attr_value); - FIX ME PLSQL -FIX ME PLSQL -begin ab_contact_attr__delete(:attr_id); end; + + select ab_contact_attr__delete(:attr_id); + Index: openacs-4/packages/address-book/www/attr-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/attr-delete-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/attr-delete-postgresql.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/attr-delete-postgresql.xql 28 Aug 2001 23:51:54 -0000 1.2 @@ -5,10 +5,8 @@ - FIX ME PLSQL -FIX ME PLSQL - begin ab_contact_attr__delete(:attr_id); end; + select ab_contact_attr__delete(:attr_id); Index: openacs-4/packages/address-book/www/attr-swap-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/attr-swap-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/attr-swap-postgresql.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/attr-swap-postgresql.xql 28 Aug 2001 23:51:54 -0000 1.2 @@ -5,21 +5,25 @@ - FIX ME ROWNUM -select attr_id from (select attr_id from ab_contact_attrs where sort_key $operator (select sort_key from ab_contact_attrs where attr_id = :attr_id) and contact_id = :contact_id order by sort_key $direction) where rownum = 1 + + select attr_id + from (select attr_id, sort_key + from ab_contact_attrs + where sort_key $operator (select sort_key + from ab_contact_attrs + where attr_id = :attr_id) and + contact_id = :contact_id) + order by sort_key $direction + limit 1 + - FIX ME PLSQL -FIX ME PLSQL - begin - ab_contact_attr__swap_sort(attr_id_one => :attr_id, - attr_id_two => :other_attr_id); - end; + select ab_contact_attr__swap_sort(:attr_id, :other_attr_id); Index: openacs-4/packages/address-book/www/contact-add-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/contact-add-2-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/contact-add-2-postgresql.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/contact-add-2-postgresql.xql 28 Aug 2001 23:51:54 -0000 1.2 @@ -5,36 +5,18 @@ - FIX ME PLSQL -FIX ME PLSQL - - begin - :1 := - ab_contact__new(contact_id => :contact_id, - creation_user => :user_id, - creation_ip => :peeraddr, - context_id => :instance_id, - first_names => :first_names, - last_name => :last_name, - title => :title, - organization => :organization, - object_id => :instance_id, - category => 'ab_contact'); - end; + select ab_contact__new(:contact_id, :user_id, :peeraddr, :instance_id, + :first_names, :last_name, :title, :organization, + :instance_id, 'ab_contact'); - FIX ME PLSQL -FIX ME PLSQL - begin acs_permission__grant_permission(object_id => :contact_id, - grantee_id => :user_id, - privilege => 'admin'); - end; + select acs_permission__grant_permission(:contact_id, :user_id, 'admin'); Index: openacs-4/packages/address-book/www/contact-delete-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/contact-delete-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/contact-delete-oracle.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/contact-delete-oracle.xql 28 Aug 2001 23:51:54 -0000 1.2 @@ -14,13 +14,19 @@ + + + + delete from acs_permissions + where object_id = :contact_id; + + + + begin - -- Delete perms on the contact - delete from acs_permissions - where object_id = :contact_id; -- Delete the contact, blowing away orphan addresses. ab_contact.delete(contact_id => :contact_id, Index: openacs-4/packages/address-book/www/contact-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/contact-delete-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/contact-delete-postgresql.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/contact-delete-postgresql.xql 28 Aug 2001 23:51:54 -0000 1.2 @@ -5,31 +5,28 @@ - FIX ME PLSQL -FIX ME PLSQL - begin - ab_contact_rel__delete(:rel_id); - end; + select ab_contact_rel__delete(:rel_id); + + + + delete from acs_permissions + where object_id = :contact_id; + + + + - FIX ME PLSQL -FIX ME PLSQL - begin - -- Delete perms on the contact - delete from acs_permissions - where object_id = :contact_id; - - -- Delete the contact, blowing away orphan addresses. - ab_contact__delete(contact_id => :contact_id, - delete_orphan_addresses_p => 't'); - end; + -- Delete the contact, blowing away orphan addresses. + ab_contact__delete(contact_id => :contact_id, + delete_orphan_addresses_p => 't'); Index: openacs-4/packages/address-book/www/contact-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/contact-delete.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/contact-delete.tcl 20 Apr 2001 20:51:12 -0000 1.1 +++ openacs-4/packages/address-book/www/contact-delete.tcl 28 Aug 2001 23:51:54 -0000 1.2 @@ -38,17 +38,19 @@ # Clean up perms on the contact and blow it away, deleting orphan addresses it is associated with. # an orphan address is an address without any location rels. - db_exec_plsql delete_orphan_address { - begin - -- Delete perms on the contact - delete from acs_permissions - where object_id = :contact_id; - - -- Delete the contact, blowing away orphan addresses. - ab_contact.delete(contact_id => :contact_id, - delete_orphan_addresses_p => 't'); - end; - } + db_transaction { + db_dml delete_orphan_address_perms { + delete from acs_permissions + where object_id = :contact_id; + } + db_exec_plsql delete_orphan_address { + begin + -- Delete the contact, blowing away orphan addresses. + ab_contact.delete(contact_id => :contact_id, + delete_orphan_addresses_p => 't'); + end; + } + } } } Index: openacs-4/packages/address-book/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/index-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/index-postgresql.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/index-postgresql.xql 28 Aug 2001 23:51:54 -0000 1.2 @@ -5,9 +5,7 @@ - FIX ME PLSQL -FIX ME PLSQL -begin :1 := acs_object__name(:instance_id); end; + select acs_object__name(:instance_id);