Home
The Toolkit for Online Communities
17518 Community Members, 0 members online, 1906 visitors today
Log In Register
OpenACS Home : ACS API Browser : ACS Subsite 5.5.1 : relation-procs.tcl
Publicity:
[Public Only | All]

relation-procs.tcl

Helpers for dealing with relations
Location:
packages/acs-subsite/tcl/relation-procs.tcl
Created:
Sun Dec 10 16:46:11 2000
Author:
mbryzek@arsdigita.com
CVS Identification:
$Id: relation-procs.tcl,v 1.15.10.1 2013/09/06 12:06:49 gustafn Exp $

Procedures in this file

Detailed information

relation::get_id (public)

 relation::get_id -object_id_one object_id_one \
    -object_id_two object_id_two [ -rel_type rel_type ]
Find the rel_id of the relation matching the given object_id_one, object_id_two, and rel_type.

Switches:
-object_id_one (required)
-object_id_two (required)
-rel_type (defaults to "membership_rel") (optional)
Returns:
rel_id of the found acs_rel, or the empty string if none existed.
 

relation::get_object_one (public)

 relation::get_object_one -object_id_two object_id_two \
    [ -rel_type rel_type ] [ -multiple ]
Return the object_id of object one if a relation of rel_type exists between the supplied object_id_two and it.

Switches:
-object_id_two (required)
-rel_type (defaults to "membership_rel") (optional)
-multiple (boolean) (optional)
 

relation::get_object_two (public)

 relation::get_object_two -object_id_one object_id_one \
    [ -rel_type rel_type ] [ -multiple ]
Return the object_id of object two if a relation of rel_type exists between the supplied object_id_one and it.

Switches:
-object_id_one (required)
-rel_type (defaults to "membership_rel") (optional)
-multiple (boolean) (optional)
 

relation::get_objects (public)

 relation::get_objects [ -object_id_one object_id_one ] \
    [ -object_id_two object_id_two ] [ -rel_type rel_type ]
Return the list of object_ids if a relation of rel_type exists between the supplied object_id and it.

Switches:
-object_id_one (optional)
-object_id_two (optional)
-rel_type (defaults to "membership_rel") (optional)
 

relation_add (public)

 relation_add [ -form_id form_id ] [ -extra_vars extra_vars ] \
    [ -variable_prefix variable_prefix ] \
    [ -creation_user creation_user ] [ -creation_ip creation_ip ] \
    [ -member_state member_state ] rel_type object_id_one \
    object_id_two
Creates a new relation of the specified type between the two objects. Throws an error if the new relation violates a relational constraint.

Switches:
-form_id (optional)
The form id from templating form system
-extra_vars (optional)
An ns_set of extra variables
-variable_prefix (optional)
Only form elements that begin with the specified prefix will be processed.
-creation_user (optional)
The user who is creating the relation
-creation_ip (optional)
-member_state (optional)
Only used for membership_relations. See column membership_rels.member_state for more info.
Parameters:
rel_type
object_id_one
object_id_two
Returns:
The rel_id of the new relation
Authors:
Michael Bryzek <mbryzek@arsdigita.com>
Ben Adida <ben@openforce.net>
Created:
1/5/2001
 

relation_permission_p (public)

 relation_permission_p [ -user_id user_id ] [ -privilege privilege ] \
    rel_id
Wrapper for ad_permission_p that lets us default to read permission

Switches:
-user_id (optional)
-privilege (defaults to "read") (optional)
Parameters:
rel_id
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000
 

relation_remove (public)

 relation_remove [ rel_id ]
Removes the specified relation. Throws an error if we violate a relational constraint by removing this relation.

Parameters:
rel_id (optional)
Returns:
1 if we delete anything. 0 otherwise (e.g. when the relation was already deleted)
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
1/5/2001
 

relation_required_segments_multirow (public)

 relation_required_segments_multirow \
    [ -datasource_name datasource_name ] [ -group_id group_id ] \
    [ -rel_type rel_type ] [ -rel_side rel_side ]
Sets up a multirow datasource. Also returns a list containing the most essential information.

Switches:
-datasource_name (optional)
-group_id (optional)
-rel_type (defaults to "membership_rel") (optional)
-rel_side (defaults to "two") (optional)
 

relation_segment_has_dependant (public)

 relation_segment_has_dependant [ -rel_id rel_id ] \
    [ -segment_id segment_id ] [ -party_id party_id ]
Returns 1 if the specified segment/party combination has a dependant (meaning a constraint would be violated if we removed this relation). 0 otherwise. Either rel_id or segment_id and party_id must be specified. rel_id takes precedence.

Switches:
-rel_id (optional)
-segment_id (optional)
-party_id (optional)
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000
 

relation_type_is_valid_to_group_p (public)

 relation_type_is_valid_to_group_p [ -group_id group_id ] rel_type
Returns 1 if group $group_id allows elements through a relation of type $rel_type, or 0 otherwise. If there are no relational constraints that prevent $group_id from being on side one of a relation of type $rel_type, then 1 is returned.

Switches:
-group_id (optional)
- if unspecified, then we use [application_group::group_id_from_package_id]
Parameters:
rel_type
Author:
Oumi Mehrotra <oumi@arsdigita.com>
Created:
2000-02-07
 

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 ]
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 [applcation_group::group_id_from_package_id] is used.
Author:
Oumi Mehrotra <oumi@arsdigita.com>
Created:
2000-02-07
 

[ show source ]