rel_types::create_role (public)

 rel_types::create_role -pretty_name pretty_name \
    -pretty_plural pretty_plural [ -role role ]

Defined in packages/acs-subsite/tcl/rel-types-procs.tcl

Create a new Relationship Role

Switches:
-pretty_name (required)
-pretty_plural (required)
-role (optional)
Returns:
1 if successful
Author:
Malte Sussdorff <sussdorff@sussdorff.de>
Created:
2005-06-04

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_rel_type_roles acs_subsite_rel_type_roles (test acs-subsite) rel_types::create_role rel_types::create_role test_acs_subsite_rel_type_roles->rel_types::create_role db_exec_plsql db_exec_plsql (public) rel_types::create_role->db_exec_plsql db_list db_list (public) rel_types::create_role->db_list db_transaction db_transaction (public) rel_types::create_role->db_transaction lang::message::register lang::message::register (public) rel_types::create_role->lang::message::register util_text_to_url util_text_to_url (public) rel_types::create_role->util_text_to_url packages/acs-subsite/www/admin/rel-types/roles/new.tcl packages/acs-subsite/ www/admin/rel-types/roles/new.tcl packages/acs-subsite/www/admin/rel-types/roles/new.tcl->rel_types::create_role

Testcases:
acs_subsite_rel_type_roles
Source code:
        if {![info exists role] || $role eq ""} {
            set role [util_text_to_url  -text $pretty_name  -replacement "_"  -existing_urls [db_list get_roles {}]]
        }

        set return_code 1

        db_transaction {

            # Force internationalization of Roles

            # Internationalising of Attributes. This is done by storing the
            # attribute with its acs-lang key

            set message_key "role_${role}"

            # Register the language keys

            lang::message::register en_US acs-translations $message_key $pretty_name
            lang::message::register en_US acs-translations "${message_key}_plural" $pretty_plural

            # Replace the pretty_name and pretty_plural with the message key, so
            # it is inserted correctly in the database

            set pretty_name "#acs-translations.${message_key}#"
            set pretty_plural "#acs-translations.${message_key}_plural#"
            db_exec_plsql create_role {}
        } on_error {
            set return_code 0
        }
        return $return_code
Generic XQL file:
<fullquery name="rel_types::create_role.get_roles">
    <querytext>
select role from acs_rel_roles
</querytext>
</fullquery>
packages/acs-subsite/tcl/rel-types-procs.xql

PostgreSQL XQL file:
<fullquery name="rel_types::create_role.create_role">
    <querytext>
      select acs_rel_type__create_role(:role, :pretty_name, :pretty_plural)
</querytext>
</fullquery>
packages/acs-subsite/tcl/rel-types-procs-postgresql.xql

Oracle XQL file:
<fullquery name="rel_types::create_role.create_role">
    <querytext>
begin  acs_rel_type.create_role(:role, :pretty_name, :pretty_plural);
end;
</querytext>
</fullquery>
packages/acs-subsite/tcl/rel-types-procs-oracle.xql

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