Index: openacs-4/packages/acs-reference/acs-reference.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-reference/acs-reference.info,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-reference/acs-reference.info 28 Aug 2001 01:12:10 -0000 1.2 +++ openacs-4/packages/acs-reference/acs-reference.info 1 Sep 2001 20:34:19 -0000 1.3 @@ -1,5 +1,5 @@ - + ACS Reference Data @@ -26,6 +26,7 @@ </ul> + @@ -34,15 +35,14 @@ - - - - + + + Index: openacs-4/packages/acs-reference/sql/postgresql/acs-reference-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-reference/sql/postgresql/acs-reference-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-reference/sql/postgresql/acs-reference-create.sql 27 Aug 2001 02:47:52 -0000 1.5 +++ openacs-4/packages/acs-reference/sql/postgresql/acs-reference-create.sql 1 Sep 2001 20:34:19 -0000 1.6 @@ -7,36 +7,28 @@ -- setup the basic admin privileges -create function inline_0 () -returns integer as ' -begin - PERFORM acs_privilege__create_privilege(''acs_reference_create''); - PERFORM acs_privilege__create_privilege(''acs_reference_write''); - PERFORM acs_privilege__create_privilege(''acs_reference_read''); - PERFORM acs_privilege__create_privilege(''acs_reference_delete''); +select acs_privilege__create_privilege('acs_reference_create'); +select acs_privilege__create_privilege('acs_reference_write'); +select acs_privilege__create_privilege('acs_reference_read'); +select acs_privilege__create_privilege('acs_reference_delete'); - PERFORM acs_privilege__add_child(''create'',''acs_reference_create''); - PERFORM acs_privilege__add_child(''write'', ''acs_reference_write''); - PERFORM acs_privilege__add_child(''read'', ''acs_reference_read''); - PERFORM acs_privilege__add_child(''delete'',''acs_reference_delete''); - - return 0; -end;' language 'plpgsql'; +select acs_privilege__add_child('create','acs_reference_create'); +select acs_privilege__add_child('write', 'acs_reference_write'); +select acs_privilege__add_child('read', 'acs_reference_read'); +select acs_privilege__add_child('delete','acs_reference_delete'); -select inline_0 (); -drop function inline_0 (); - -- Create the basic object type used to represent a reference database select acs_object_type__create_type ( - 'acs_object', 'acs_reference_repository', 'ACS Reference Repository', 'ACS Reference Repositories', + 'acs_object', 'acs_reference_repositories', 'repository_id', + null, 'f', null, - 'acs_object.default_name' + 'acs_object__default_name' ); -- A table to store metadata for each reference database @@ -51,9 +43,7 @@ constraint arr_table_name_nn not null constraint arr_table_name_uq unique, -- is this external or internal data - internal_data_p char(1) - constraint arr_internal_data_p_ck - check (internal_data_p in ('t','f')), + internal_data_p boolean, -- Does this source include pl/sql package? package_name varchar(100) constraint arr_package_name_uq unique, @@ -63,89 +53,65 @@ source varchar(1000), source_url varchar(255), -- should default to today - effective_date timestamp -- default sysdate + effective_date timestamp, -- default sysdate expiry_date timestamp, -- a text field to hold the maintainer maintainer_id integer constraint arr_maintainer_id_fk references persons(person_id), -- this could be ancillary docs, pdf's etc -- needs to be fixed for PG - notes blob + -- DRB: needs to use Content Repository for both PG and Oracle, no??? + lob integer ); -- API --- made initially for PG -create function acs_reference__new (varchar,timestamp, -varchar,varchar,timestamp) -returns integer as ' -declare - table_name alias for $1; -- - last_update alias for $2; -- default sysdate - source alias for $3; -- default null - source_url alias for $4; -- default null - effective_date alias for $5; -- default sysdate -) - v_repository_id := acs_object__new ( - object_id, - sysdate(), - null, - null, - 'acs_reference_repository' - ); - insert into acs_reference_repositories - (repository_id,table_name, - last_update,source, - source_url,effective_date) - values - (v_repository_id,table_name, - last_update,source,source_url, - effective_date); - return v_repository_id; -end; -' language 'plpgsql'; - -- default for Oracle -create function acs_reference__new (integer,varchar,char,varchar,timestamp, -varchar,varchar,timestamp,timestamp,integer,blob,timestamp, + +create function acs_reference__new (integer,varchar,boolean,varchar,timestamp, +varchar,varchar,timestamp,timestamp,integer,integer,varchar,varchar, integer,varchar,integer) returns integer as ' declare - repository_id alias for $1; -- default null - table_name alias for $2; -- - internal_data_p alias for $3; -- default 'f' - package_name alias for $4; -- default null - last_update alias for $5; -- default sysdate - source alias for $6; -- default null - source_url alias for $7; -- default null - effective_date alias for $8; -- default sysdate - expiry_date alias for $9; -- default null - maintainer_id alias for $10; -- default null - notes alias for $11; -- default empty_blob() + p_repository_id alias for $1; -- default null + p_table_name alias for $2; -- + p_internal_data_p alias for $3; -- default "f" + p_package_name alias for $4; -- default null + p_last_update alias for $5; -- default sysdate + p_source alias for $6; -- default null + p_source_url alias for $7; -- default null + p_effective_date alias for $8; -- default sysdate + p_expiry_date alias for $9; -- default null + p_maintainer_id alias for $10; -- default null + p_notes alias for $11; -- default null (not Oracle empty_blob()) -- I really see no need for these as parameters -- creation_date alias for $12; -- default sysdate - first_names alias for $12; -- default null - last_names alias for $13; -- default null - creation_ip alias for $14; -- default null - object_type alias for $15; -- default 'acs_reference_repository' - creation_user alias for $16; -- default null -) - if object_type is null then - v_object_type := 'acs_reference_repository'; + p_first_names alias for $12; -- default null + p_last_name alias for $13; -- default null + p_creation_ip alias for $14; -- default null + p_object_type alias for $15; -- default "acs_reference_repository" + p_creation_user alias for $16; -- default null + v_repository_id acs_reference_repositories.repository_id%TYPE; + v_object_type acs_objects.object_type%TYPE; + v_maintainer_id persons.person_id%TYPE; +begin + if p_object_type is null then + v_object_type := ''acs_reference_repository''; else - v_object_type := object_type; + v_object_type := p_object_type; end if; v_repository_id := acs_object__new ( - object_id, - sysdate(), - creation_user, - creation_ip, - v_object_type + p_repository_id, + v_object_type, + now(), + p_creation_user, + p_creation_ip, + null ); - -- This logic isn't correct as the maintainer could already exist + -- This logic is not correct as the maintainer could already exist -- The way around this is a little clunky as you can search persons -- then pick an existing person or add a new one, to many screens! -- I really doubt the need for person anyway. @@ -159,31 +125,47 @@ -- This needs to be updated in the Oracle version also -- NEEDS TO BE FIXED - jag - if first_names is not null and last_name is not null and maintainer_id is null then - v_maintainer_id := person__new ( - first_names, - last_name, - null -- email - ); - else if maintainer_id is not null - v_maintainer_id := maintainer_id; + if p_first_names is not null and p_last_name is not null and p_maintainer_id is null then + v_maintainer_id := person__new (null, ''person'', now(), null, null, null, null, + p_first_names, p_last_name, null); + else if p_maintainer_id is not null then + v_maintainer_id := p_maintainer_id; else v_maintainer_id := null; end if; + end if; - insert into acs_reference_repositories - (repository_id,table_name,internal_data_p, - last_update,package_name,source, - source_url,effective_date,expiry_date, - maintainer_id,notes) - values - (v_repository_id,table_name,internal_data_p, - last_update,package_name,source,source_url, - effective_date,expiry_date,v_maintainer_id,notes); - return v_repository_id; + insert into acs_reference_repositories + (repository_id,table_name,internal_data_p, + last_update,package_name,source, + source_url,effective_date,expiry_date, + maintainer_id,lob) + values + (v_repository_id, p_table_name, p_internal_data_p, + p_last_update, p_package_name, p_source, p_source_url, + p_effective_date, p_expiry_date, v_maintainer_id, p_notes); + + return v_repository_id; end; ' language 'plpgsql'; +-- made initially for PG +create function acs_reference__new (varchar,timestamp, +varchar,varchar,timestamp) +returns integer as ' +declare + p_table_name alias for $1; -- + p_last_update alias for $2; -- default sysdate + p_source alias for $3; -- default null + p_source_url alias for $4; -- default null + p_effective_date alias for $5; -- default sysdate + v_repository_id acs_reference_repositories.repository_id%TYPE; +begin + return acs_reference__new(null, p_table_name, ''f'', null, null, p_source, p_source_url, + p_effective_date, null, null, null, null, null, null, + ''acs_reference_repository'', null); +end; +' language 'plpgsql'; create function acs_reference__delete (integer) returns integer as ' @@ -213,10 +195,10 @@ from acs_reference_repositories where repository_id = is_expired_p.repository_id; - if nvl(v_expiry_date,sysdate()+1) < sysdate() then - return 't'; + if coalesce(v_expiry_date,now()+1) < now() then + return ''t''; else - return 'f'; + return ''f''; end if; end; ' language 'plpgsql'; Index: openacs-4/packages/acs-reference/sql/postgresql/acs-reference-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-reference/sql/postgresql/acs-reference-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-reference/sql/postgresql/acs-reference-drop.sql 17 Jul 2001 01:44:58 -0000 1.1 +++ openacs-4/packages/acs-reference/sql/postgresql/acs-reference-drop.sql 1 Sep 2001 20:34:19 -0000 1.2 @@ -3,39 +3,40 @@ -- Drop the ACS Reference packages -- -- @author jon@jongriffin.com --- @created 2001-07-16 +-- @dropd 2001-07-16 -- -- @cvs-id $Id$ -- -set serveroutput on +-- drop all associated tables and functions --- drop all associated tables and packages +-- DRB: in PG we could do this dynamically as JonG has done in Oracle. The +-- proc name can easily be picked up from pg_proc since we use unique package +-- keys as prefaces. The params can be picked up as well but I don't know +-- how off the top of my head. It would be a nice to write a general function +-- to do this in both Oracle and PG - "drop_package_functions(package_key)". -declare - cursor refsrc_cur is - select table_name, - package_name - from acs_reference_repositories - order by creation_date desc; -begin - for rec in refsrc_cur loop - dbms_output.put_line('Dropping ' || rec.table_name); - execute immediate 'drop table ' || rec.table_name; - if rec.package_name is not null then - execute immediate 'drop package ' || rec.package_name; - end if; - end loop; -end; -/ -show errors + +select acs_privilege__remove_child('create','acs_reference_create'); +select acs_privilege__remove_child('write', 'acs_reference_write'); +select acs_privilege__remove_child('read', 'acs_reference_read'); +select acs_privilege__remove_child('delete','acs_reference_delete'); -begin - acs_object_type.drop_type('acs_reference_repository','t'); -end; -/ -show errors - -drop package acs_reference_repository; +select acs_privilege__drop_privilege('acs_reference_create'); +select acs_privilege__drop_privilege('acs_reference_write'); +select acs_privilege__drop_privilege('acs_reference_read'); +select acs_privilege__drop_privilege('acs_reference_delete'); + +select acs_object__delete(repository_id) +from acs_reference_repositories; + +select acs_object_type__drop_type ('acs_reference_repository', 't'); + +drop function acs_reference__new (varchar,timestamp, varchar,varchar,timestamp); +drop function acs_reference__new (integer,varchar,boolean,varchar,timestamp, +varchar,varchar,timestamp,timestamp,integer,integer,varchar,varchar, +integer,varchar,integer); +drop function acs_reference__delete (integer); +drop function acs_reference__is_expired_p (integer); drop table acs_reference_repositories; Index: openacs-4/packages/acs-reference/www/reference-data-list-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-reference/www/reference-data-list-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-reference/www/reference-data-list-postgresql.xql 28 Aug 2001 04:00:52 -0000 1.1 +++ openacs-4/packages/acs-reference/www/reference-data-list-postgresql.xql 1 Sep 2001 20:34:19 -0000 1.2 @@ -10,7 +10,7 @@ table_name, internal_data_p, package_name, - to_char(last_update,'MM-DD-YYYY') updated, + to_char(last_update,'MM-DD-YYYY') as updated, source, source_url, effective_date, 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.2 -r1.3 --- openacs-4/packages/address-book/address-book.info 28 Aug 2001 23:51:53 -0000 1.2 +++ openacs-4/packages/address-book/address-book.info 1 Sep 2001 20:34:19 -0000 1.3 @@ -1,5 +1,5 @@ - + Address Book @@ -81,6 +81,7 @@ + Index: openacs-4/packages/address-book/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/index-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/index-oracle.xql 22 Aug 2001 23:11:49 -0000 1.1 +++ openacs-4/packages/address-book/www/index-oracle.xql 1 Sep 2001 20:34:19 -0000 1.2 @@ -9,5 +9,25 @@ + + + select contact_id, + nvl(last_name,'
') as last_name, + nvl(first_names,'
') as first_names, + nvl(title,'
') as title, + nvl(organization,'
') as organization, + nvl(work_phone,'
') as work_phone, + nvl(home_phone,'
') as home_phone, + nvl(fax,'
') as fax, + nvl(other,'
') as other, + nvl(email,'
') as email, + acs_permission.permission_p(acr.rel_id,:user_id,'delete') as delete_p, + acr.rel_id + from ab_contacts_related acr + where acs_permission.permission_p(contact_id,:user_id,'read') = 't' + and object_id = :instance_id + [value_if_exists search_filter] +
+
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.2 -r1.3 --- openacs-4/packages/address-book/www/index-postgresql.xql 28 Aug 2001 23:51:54 -0000 1.2 +++ openacs-4/packages/address-book/www/index-postgresql.xql 1 Sep 2001 20:34:19 -0000 1.3 @@ -9,5 +9,26 @@ + + + select contact_id, + coalesce(last_name,'
') as last_name, + coalesce(first_names,'
') as first_names, + coalesce(title,'
') as title, + coalesce(organization,'
') as organization, + coalesce(work_phone,'
') as work_phone, + coalesce(home_phone,'
') as home_phone, + coalesce(fax,'
') as fax, + coalesce(other,'
') as other, + coalesce(email,'
') as email, + acs_permission__permission_p(acr.rel_id,:user_id,'delete') as delete_p, + acr.rel_id + from ab_contacts_related acr + where acs_permission__permission_p(contact_id,:user_id,'read') = 't' + and object_id = :instance_id + [value_if_exists search_filter] +
+
+ Index: openacs-4/packages/address-book/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/address-book/www/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/address-book/www/index.tcl 20 Apr 2001 20:51:12 -0000 1.1 +++ openacs-4/packages/address-book/www/index.tcl 1 Sep 2001 20:34:19 -0000 1.2 @@ -40,17 +40,13 @@ regsub -all {%} $substr {} substr - set like_clause "like '%[string tolower $substr]%'" + set substr [string tolower $substr] - set search_filter "and (lower(last_name) $like_clause - or lower(first_names) $like_clause - or lower(title) $like_clause - or lower(organization) $like_clause - or lower(work_phone) $like_clause - or lower(home_phone) $like_clause - or lower(fax) $like_clause - or lower(other) $like_clause - or lower(email) $like_clause)" + # DRB: This depends on support for partial string matches of some sort... + set like_clause [db_map like_clause] + + set search_filter [db_map search_filter] + } set datadef { @@ -72,24 +68,8 @@ # This invokes a bunch of functions, which is bad, I think, but maybe it's still way faster than the # join, 'cause the view meant for joining has been commented out in the permission SQL file... ? -set sql_query " - select contact_id, - nvl(last_name,'
') as last_name, - nvl(first_names,'
') as first_names, - nvl(title,'
') as title, - nvl(organization,'
') as organization, - nvl(work_phone,'
') as work_phone, - nvl(home_phone,'
') as home_phone, - nvl(fax,'
') as fax, - nvl(other,'
') as other, - nvl(email,'
') as email, - acs_permission.permission_p(acr.rel_id,:user_id,'delete') as delete_p, - acr.rel_id - from ab_contacts_related acr - where acs_permission.permission_p(contact_id,:user_id,'read') = 't' - and object_id = :instance_id - [value_if_exists search_filter] -" +set sql_query [db_map sql_query] + append sql_query [ad_order_by_from_sort_spec $orderby $datadef] if { $instance_id && $user_id } { @@ -99,4 +79,4 @@ set contact_table [ad_table -Torderby $orderby -bind $bind_vars address_book_listing $sql_query $datadef] -ad_return_template \ No newline at end of file +ad_return_template Index: openacs-4/packages/ref-language/ref-language.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ref-language/ref-language.info,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ref-language/ref-language.info 27 Aug 2001 22:19:46 -0000 1.2 +++ openacs-4/packages/ref-language/ref-language.info 1 Sep 2001 20:34:19 -0000 1.3 @@ -1,5 +1,5 @@ - + ACS Reference Language @@ -26,8 +26,8 @@ + - Index: openacs-4/packages/ref-language/sql/oracle/ref-language-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ref-language/sql/oracle/ref-language-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ref-language/sql/oracle/ref-language-create.sql 27 Aug 2001 05:39:22 -0000 1.3 +++ openacs-4/packages/ref-language/sql/oracle/ref-language-create.sql 1 Sep 2001 20:34:19 -0000 1.4 @@ -46,4 +46,5 @@ / -- data, but this doesn't work from the apm -@ '../common/ref-language-data.sql' \ No newline at end of file +@ '../common/ref-language-data.sql' +commit;