Index: openacs-4/packages/acs-service-contract/acs-service-contract.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/acs-service-contract.info,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-service-contract/acs-service-contract.info 17 May 2003 09:55:57 -0000 1.13 +++ openacs-4/packages/acs-service-contract/acs-service-contract.info 10 Sep 2003 14:52:01 -0000 1.14 @@ -7,7 +7,7 @@ t t - + oracle @@ -19,7 +19,7 @@ 2003-02-05 OpenACS - + Index: openacs-4/packages/acs-service-contract/sql/oracle/acs-sc-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/sql/oracle/acs-sc-packages-create.sql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-service-contract/sql/oracle/acs-sc-packages-create.sql 17 May 2003 09:56:18 -0000 1.9 +++ openacs-4/packages/acs-service-contract/sql/oracle/acs-sc-packages-create.sql 10 Sep 2003 14:52:01 -0000 1.10 @@ -59,6 +59,7 @@ function new ( impl_contract_name acs_sc_impls.impl_contract_name%TYPE, impl_name acs_sc_impls.impl_name%TYPE, + impl_pretty_name acs_sc_impls.impl_pretty_name%TYPE, impl_owner_name acs_sc_impls.impl_owner_name%TYPE ) return acs_sc_impls.impl_id%TYPE; @@ -334,6 +335,7 @@ function new ( impl_contract_name acs_sc_impls.impl_contract_name%TYPE, impl_name acs_sc_impls.impl_name%TYPE, + impl_pretty_name acs_sc_impls.impl_pretty_name%TYPE, impl_owner_name acs_sc_impls.impl_owner_name%TYPE ) return acs_sc_impls.impl_id%TYPE is @@ -343,12 +345,14 @@ insert into acs_sc_impls ( impl_id, - impl_name, + impl_name, + impl_pretty_name, impl_owner_name, impl_contract_name ) values ( v_impl_id, impl_name, + impl_pretty_name, impl_owner_name, impl_contract_name ); @@ -453,8 +457,6 @@ / show errors - - create or replace package body acs_sc_impl_alias as @@ -512,7 +514,7 @@ end acs_sc_impl_alias; / -show errors +show errors create or replace package body acs_sc_binding as Index: openacs-4/packages/acs-service-contract/sql/oracle/acs-sc-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/sql/oracle/acs-sc-tables-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-service-contract/sql/oracle/acs-sc-tables-create.sql 31 Jan 2002 03:04:32 -0000 1.3 +++ openacs-4/packages/acs-service-contract/sql/oracle/acs-sc-tables-create.sql 10 Sep 2003 14:52:01 -0000 1.4 @@ -55,6 +55,7 @@ constraint acs_sc_impl_pk primary key, impl_name varchar2(100), + impl_pretty_name varchar2(200), impl_owner_name varchar2(1000), impl_contract_name varchar2(1000) ); Index: openacs-4/packages/acs-service-contract/sql/postgresql/acs-sc-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/sql/postgresql/acs-sc-packages-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-service-contract/sql/postgresql/acs-sc-packages-create.sql 16 Sep 2002 12:52:51 -0000 1.5 +++ openacs-4/packages/acs-service-contract/sql/postgresql/acs-sc-packages-create.sql 10 Sep 2003 14:52:01 -0000 1.6 @@ -211,12 +211,13 @@ -create function acs_sc_impl__new(varchar,varchar,varchar) +create function acs_sc_impl__new(varchar,varchar,varchar,varchar) returns integer as ' declare p_impl_contract_name alias for $1; p_impl_name alias for $2; - p_impl_owner_name alias for $3; + p_impl_pretty_name alias for $3; + p_impl_owner_name alias for $4; v_impl_id integer; begin @@ -232,11 +233,13 @@ insert into acs_sc_impls ( impl_id, impl_name, + impl_pretty_name, impl_owner_name, impl_contract_name ) values ( v_impl_id, p_impl_name, + p_impl_pretty_name, p_impl_owner_name, p_impl_contract_name ); Index: openacs-4/packages/acs-service-contract/sql/postgresql/acs-sc-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/sql/postgresql/acs-sc-tables-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-service-contract/sql/postgresql/acs-sc-tables-create.sql 7 Oct 2001 07:21:05 -0000 1.4 +++ openacs-4/packages/acs-service-contract/sql/postgresql/acs-sc-tables-create.sql 10 Sep 2003 14:52:01 -0000 1.5 @@ -55,6 +55,7 @@ constraint acs_sc_impls_pk primary key, impl_name varchar(100), + impl_pretty_name varchar(200), impl_owner_name varchar(1000), impl_contract_name varchar(1000) ); Index: openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl 10 Sep 2003 09:43:05 -0000 1.18 +++ openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl 10 Sep 2003 14:52:01 -0000 1.19 @@ -45,7 +45,7 @@ acs_sc::impl::get -impl_id $impl_id -array impl_info set impl $impl_info(impl_name) if { ![empty_string_p $contract] && ![string equal $contract $impl_info(impl_contract_name)] } { - error "The cotnract of implementation with id $impl_id does not match contract passed in. Expected contract to be '$contract', but contract of impl_id was '$impl_info(impl_contract_name)'" + error "The contract of implementation with id $impl_id does not match contract passed in. Expected contract to be '$contract', but contract of impl_id was '$impl_info(impl_contract_name)'" } set contract $impl_info(impl_contract_name) } Index: openacs-4/packages/acs-service-contract/tcl/implementation-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/implementation-procs-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-service-contract/tcl/implementation-procs-oracle.xql 25 Feb 2003 15:15:33 -0000 1.2 +++ openacs-4/packages/acs-service-contract/tcl/implementation-procs-oracle.xql 10 Sep 2003 14:52:01 -0000 1.3 @@ -7,8 +7,9 @@ begin :1 := acs_sc_impl.new( - :contract_name, + :contract_name, :name, + :pretty_name, :owner ); end; Index: openacs-4/packages/acs-service-contract/tcl/implementation-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/implementation-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-service-contract/tcl/implementation-procs-postgresql.xql 3 Feb 2003 12:17:36 -0000 1.1 +++ openacs-4/packages/acs-service-contract/tcl/implementation-procs-postgresql.xql 10 Sep 2003 14:52:01 -0000 1.2 @@ -8,6 +8,7 @@ select acs_sc_impl__new( :contract_name, :name, + :pretty_name, :owner ); Index: openacs-4/packages/acs-service-contract/tcl/implementation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/implementation-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-service-contract/tcl/implementation-procs.tcl 3 Sep 2003 19:51:06 -0000 1.4 +++ openacs-4/packages/acs-service-contract/tcl/implementation-procs.tcl 10 Sep 2003 14:52:01 -0000 1.5 @@ -20,6 +20,7 @@ ad_proc -public acs_sc::impl::new { {-contract_name:required} {-name:required} + {-pretty_name:required} {-owner:required} } { Add new service contract implementation. @@ -58,6 +59,7 @@ contract_name "Action_SideEffect" owner "bug-tracker" name "CaptureResolutionCode" + pretty_name "Capture Resolution Code" aliases { GetObjectType bug_tracker::bug::object_type GetPrettyName bug_tracker::bug::capture_resolution_code::pretty_name @@ -77,6 +79,7 @@
  • contract_name: The name of the service contract you're implementing.
  • owner: Owner of the implementation, use the package-key.
  • name: Name of your implementation. +
  • name: Pretty name of your implementation. You'd typically use this when displaying the service contract implementation through a UI.
  • aliases: Specification of the tcl procedures for each of the service contract's operations. @@ -88,15 +91,20 @@ @return the impl_id of the newly registered implementation } { - # Spec contains: contract_name, name, owner, aliases + # Spec contains: contract_name, name, pretty_name, owner, aliases array set impl $spec + if { ![exists_and_not_null impl(pretty_name)] } { + set impl(pretty_name) "" + } + db_transaction { set impl_id [new \ -contract_name $impl(contract_name) \ -name $impl(name) \ + -pretty_name $impl(pretty_name) \ -owner $impl(owner)] - + acs_sc::impl::alias::parse_aliases_spec \ -contract_name $impl(contract_name) \ -impl_name $impl(name) \ @@ -135,6 +143,52 @@ db_1row select_impl {} -column_array row } +ad_proc -public acs_sc::impl::get_options { + {-contract_name:required} + {-exclude_names ""} + {-empty_option:boolean} +} { + Get a list of service contract implementation options + for an HTML multiple choice widget. + + @param contract_name The name of the service contract + to return options for. + + @param exclude_names A list of implementation names to exclude + @param empty_option_p If provided an empty option is added + + @return A list of lists with the inner lists having label in first element and id in second. + + @author Peter Marklund +} { + set full_list [db_list_of_lists select_impl_options { + select impl_name, + impl_id + from acs_sc_impls + where impl_contract_name = :contract_name + }] + + if { [llength $exclude_names] > 0 } { + # There are exclude names + foreach element $full_list { + set impl_name [lindex $element 0] + if { [lsearch -exact $exclude_names $impl_name] == -1 } { + # Name is not in exclude list so add option + lappend impl_list $element + } + } + } else { + # No exclude names, use all options + set impl_list $full_list + } + + if { $empty_option_p } { + lappend impl_list [list "-" ""] + } + + return $impl_list +} + ##### # # Aliases Index: openacs-4/packages/acs-service-contract/tcl/implementation-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/implementation-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-service-contract/tcl/implementation-procs.xql 3 Sep 2003 19:51:06 -0000 1.2 +++ openacs-4/packages/acs-service-contract/tcl/implementation-procs.xql 10 Sep 2003 14:52:01 -0000 1.3 @@ -13,7 +13,8 @@ - select impl_name, + select impl_name, + impl_pretty_name, impl_owner_name, impl_contract_name from acs_sc_impls