auth::get_registration_form_elements (public)

 auth::get_registration_form_elements

Defined in packages/acs-authentication/tcl/authentication-procs.tcl

Returns a list of elements to be included in the -form chunk of an ad_form form. All possible elements will always be present, but those that shouldn't be displayed will be hidden and have a hard-coded empty string value.

Partial Call Graph (max 5 caller/called nodes):
%3 test_auth_get_registration_form_elements auth_get_registration_form_elements (test acs-authentication) auth::get_registration_form_elements auth::get_registration_form_elements test_auth_get_registration_form_elements->auth::get_registration_form_elements _ _ (public) auth::get_registration_form_elements->_ auth::get_all_registration_elements auth::get_all_registration_elements (public) auth::get_registration_form_elements->auth::get_all_registration_elements auth::get_registration_elements auth::get_registration_elements (public) auth::get_registration_form_elements->auth::get_registration_elements packages/acs-subsite/lib/user-new.tcl packages/acs-subsite/ lib/user-new.tcl packages/acs-subsite/lib/user-new.tcl->auth::get_registration_form_elements

Testcases:
auth_get_registration_form_elements
Source code:
    array set data_types {
        username text
        email text
        first_names text
        last_name text
        screen_name text
        url text
        password text
        password_confirm text
        secret_question text
        secret_answer text
    }

    array set widgets {
        username text
        email email
        first_names text
        last_name text
        screen_name text
        url url
        password password
        password_confirm password
        secret_question text
        secret_answer text
    }

    array set labels [list  username [_ acs-subsite.Username]  email [_ acs-subsite.Email]  first_names [_ acs-subsite.First_names]  last_name [_ acs-subsite.Last_name]  screen_name [_ acs-subsite.Screen_name]  url [_ acs-subsite.lt_Personal_Home_Page_UR]  password [_ acs-subsite.Password]  password_confirm [_ acs-subsite.lt_Password_Confirmation]  secret_question [_ acs-subsite.Question]  secret_answer [_ acs-subsite.Answer]]

    array set html {
        username {size 30}
        email {size 30}
        first_names {size 30}
        last_name {size 30}
        screen_name {size 30}
        url {size 80 value ""}
        password {size 20}
        password_confirm {size 20}
        secret_question {size 30}
        secret_answer {size 30}
    }

    array set element_info [auth::get_registration_elements]

    # provide default help texts, might be refined later.
    array set help_text {
        username {}
        email {}
        first_names {}
        last_name {}
        screen_name {}
        url {}
        password {}
        password_confirm {}
        secret_question {}
        secret_answer {}
    }

    if {"password" in $element_info(required)} {
        lappend element_info(required) password_confirm
    }
    if {"password" in $element_info(optional)} {
        lappend element_info(optional) password_confirm
    }

    # required_p will have 1 if required, 0 if optional, and unset if not in the form
    array set required_p [list]
    foreach element $element_info(required) {
        set required_p($element) 1
    }
    foreach element $element_info(optional) {
        set required_p($element) 0
    }

    set form_elements [list]
    foreach element [auth::get_all_registration_elements -include_password_confirm] {
        if { [info exists required_p($element)] } {
            set form_element [list]

            # The header with name, datatype, and widget
            set form_element_header "${element}:$data_types($element)($widgets($element))"

            if { !$required_p($element) } {
                append form_element_header ",optional"
            }
            lappend form_element $form_element_header

            # The label
            lappend form_element [list label $labels($element)]

            # HTML
            lappend form_element [list html $html($element)]

            # Help Text
            lappend form_element [list help_text $help_text($element)]

            # The form element is finished - add it to the list
            lappend form_elements $form_element
        } else {
            lappend form_elements "${element}:text(hidden),optional {value {}}"
        }
    }

    return $form_elements
Generic XQL file:
packages/acs-authentication/tcl/authentication-procs.xql

PostgreSQL XQL file:
packages/acs-authentication/tcl/authentication-procs-postgresql.xql

Oracle XQL file:
packages/acs-authentication/tcl/authentication-procs-oracle.xql

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