party::types_valid_for_rel_type_multirow (public)

 party::types_valid_for_rel_type_multirow \
    [ -datasource_name datasource_name ] [ -start_with start_with ] \
    [ -rel_type rel_type ]

Defined in packages/acs-tcl/tcl/community-core-procs.tcl

creates multirow datasource containing party types starting with the $start_with party type. The datasource has columns that are identical to the relation_types_allowed_to_group_multirow, which is why the columns are broadly named "object_*" instead of "party_*". A common template can be used for generating select widgets etc. for both this datasource and the relation_types_allowed_to_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. 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
  • valid_p - 1 or 0 depending on whether the type is valid

Switches:
-datasource_name
(defaults to "object_types") (optional)
-start_with
(defaults to "party") (optional)
-rel_type
(defaults to "membership_rel") (optional)
- if unspecified, then membership_rel 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/groups/new.tcl packages/acs-subsite/ www/admin/groups/new.tcl party::types_valid_for_rel_type_multirow party::types_valid_for_rel_type_multirow packages/acs-subsite/www/admin/groups/new.tcl->party::types_valid_for_rel_type_multirow packages/acs-subsite/www/admin/parties/new.tcl packages/acs-subsite/ www/admin/parties/new.tcl packages/acs-subsite/www/admin/parties/new.tcl->party::types_valid_for_rel_type_multirow packages/acs-subsite/www/admin/users/new.tcl packages/acs-subsite/ www/admin/users/new.tcl packages/acs-subsite/www/admin/users/new.tcl->party::types_valid_for_rel_type_multirow ad_urlencode ad_urlencode (public) party::types_valid_for_rel_type_multirow->ad_urlencode db_foreach db_foreach (public) party::types_valid_for_rel_type_multirow->db_foreach db_map db_map (public) party::types_valid_for_rel_type_multirow->db_map template::multirow template::multirow (public) party::types_valid_for_rel_type_multirow->template::multirow

Testcases:
No testcase defined.
Source code:

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

    # Special case "party" because we don't want to display "party" itself
    # as an option, and we don't want to display "rel_segment" as an
    # option.
    if {$start_with eq "party"} {
        set start_with_clause [db_map start_with_clause_party]
    } else {
        set start_with_clause [db_map start_with_clause]
    }

    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-tcl/tcl/community-core-procs.xql

PostgreSQL XQL file:
<fullquery name="party::types_valid_for_rel_type_multirow.start_with_clause_party">
    <querytext>
    (t1.object_type = 'group' or t1.object_type = 'person')
  </querytext>
</fullquery>

<fullquery name="party::types_valid_for_rel_type_multirow.start_with_clause">
    <querytext>
    t1.object_type = :start_with
  </querytext>
</fullquery>

<fullquery name="party::types_valid_for_rel_type_multirow.select_sub_rel_types">
    <querytext>

	select types.pretty_name,
	       types.object_type,
	       types.tree_level,
	       types.indent,
	       case when valid_types.object_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 tree_level,
		       repeat('&nbsp;', (tree_level(t2.tree_sortkey) - tree_level(t1.tree_sortkey)) * 4) as indent,
		       t2.tree_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 $start_with_clause ) types
                  left outer join
	            (select object_type
		       from rel_types_valid_obj_two_types
		      where rel_type = :rel_type ) valid_types
		    using (object_type)
         order by types.tree_sortkey

  </querytext>
</fullquery>
packages/acs-tcl/tcl/community-core-procs-postgresql.xql

Oracle XQL file:
<fullquery name="party::types_valid_for_rel_type_multirow.start_with_clause_party">
    <querytext>
    (object_type = 'group' or object_type = 'person')
  </querytext>
</fullquery>

<fullquery name="party::types_valid_for_rel_type_multirow.start_with_clause">
    <querytext>
    object_type = :start_with
  </querytext>
</fullquery>

<fullquery name="party::types_valid_for_rel_type_multirow.select_sub_rel_types">
    <querytext>

	select
	    types.pretty_name,
	    types.object_type,
	    types.tree_level,
	    types.indent,
	    case when valid_types.object_type = null then 0 else 1 end as valid_p
	from
	    (select
	        t.pretty_name, t.object_type, level as tree_level,
	        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
	        $start_with_clause ) types,
	    (select
	        object_type
	     from
	        rel_types_valid_obj_two_types
	     where
	        rel_type = :rel_type ) valid_types
	where
	    types.object_type = valid_types.object_type(+)
	order by tree_rownum

  </querytext>
</fullquery>
packages/acs-tcl/tcl/community-core-procs-oracle.xql

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