relation_types_valid_to_group_multirow (public)

 relation_types_valid_to_group_multirow \
    [ -datasource_name datasource_name ] [ -start_with start_with ] \
    [ -group_id group_id ]

Defined in packages/acs-subsite/tcl/relation-procs.tcl

creates multirow datasource containing relationship types starting with the $start_with relationship type. The datasource has columns that are identical to the party::types_allowed_in_group_multirow, which is why the columns are broadly named "object_*" instead of "rel_*". A common template can be used for generating select widgets etc. for both this datasource and the party::types_allowed_in_groups_multirow datasource. All subtypes of $start_with are returned, but the "valid_p" column in the datasource indicates whether the type is a valid one for $group_id. If -group_id is not specified or is specified null, then the current application_group will be used (determined from [application_group::group_id_from_package_id]). Includes fields that are useful for presentation in a hierarchical select widget:

  • object_type
  • object_type_enc - encoded object type
  • indent - an HTML indentation string
  • pretty_name - pretty name of object type

Switches:
-datasource_name
(defaults to "object_types") (optional)
-start_with
(defaults to "acs_rel") (optional)
-group_id
(optional)
- if unspecified, then [application_group::group_id_from_package_id] is used.
Author:
Oumi Mehrotra <oumi@arsdigita.com>
Created:
2000-02-07

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-subsite/www/admin/relations/add.tcl packages/acs-subsite/ www/admin/relations/add.tcl relation_types_valid_to_group_multirow relation_types_valid_to_group_multirow packages/acs-subsite/www/admin/relations/add.tcl->relation_types_valid_to_group_multirow ad_urlencode ad_urlencode (public) relation_types_valid_to_group_multirow->ad_urlencode application_group::group_id_from_package_id application_group::group_id_from_package_id (public) relation_types_valid_to_group_multirow->application_group::group_id_from_package_id db_foreach db_foreach (public) relation_types_valid_to_group_multirow->db_foreach template::multirow template::multirow (public) relation_types_valid_to_group_multirow->template::multirow

Testcases:
No testcase defined.
Source code:

    if {$group_id eq ""} {
        set group_id [application_group::group_id_from_package_id]
    }

    template::multirow create $datasource_name  object_type object_type_enc indent pretty_name valid_p

    db_foreach select_sub_rel_types {} {
        template::multirow append $datasource_name $object_type [ad_urlencode $object_type$indent $pretty_name $valid_p
    }
Generic XQL file:
packages/acs-subsite/tcl/relation-procs.xql

PostgreSQL XQL file:
<fullquery name="relation_types_valid_to_group_multirow.select_sub_rel_types">
    <querytext>    
	select
		pretty_name, object_type, level, indent,
		case when valid_types.rel_type = null then 0 else 1 end as valid_p
	from 
		(select
			t2.pretty_name, t2.object_type, tree_level(t2.tree_sortkey) - tree_level(t1.tree_sortkey) as level,
		        repeat('&nbsp;', (tree_level(t2.tree_sortkey) - tree_level(t1.tree_sortkey)) * 4) as indent,
	        	t2.tree_sortkey as sortkey
		from
			acs_object_types t1,
			acs_object_types t2
		where	t2.tree_sortkey between t1.tree_sortkey and tree_right(t1.tree_sortkey)
		  and   t1.object_type = :start_with) types left join
		(select
			rel_type
		from
			rc_valid_rel_types
		where
			group_id= :group_id) valid_types
	on (types.object_type = valid_types.rel_type)
	order by sortkey
		

	
      </querytext>
</fullquery>
packages/acs-subsite/tcl/relation-procs-postgresql.xql

Oracle XQL file:
<fullquery name="relation_types_valid_to_group_multirow.select_sub_rel_types">
    <querytext>
      
	select 
	    pretty_name, object_type, indent,
	    case when valid_types.rel_type = null then 0 else 1 end as valid_p
	from 
	    (select
	        t.pretty_name, t.object_type,
	        replace(lpad(' ', (level - 1) * 4), 
	                ' ', '&nbsp;') as indent,
	        rownum as tree_rownum
	     from 
	        acs_object_types t
	     connect by 
	        prior t.object_type = t.supertype
	     start with 
	        t.object_type = :start_with ) types,
	    (select 
	        rel_type 
	     from 
	        rc_valid_rel_types
	     where 
	        group_id = :group_id ) valid_types
	where 
	    types.object_type = valid_types.rel_type(+)
	order by tree_rownum
    
      </querytext>
</fullquery>
packages/acs-subsite/tcl/relation-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: