• Publicity: Public Only All

data-procs.tcl

Datatype validation for the ArsDigita Templating System

Location:
packages/acs-templating/tcl/data-procs.tcl
Author:
Karl Goldstein <karlg@arsdigita.com>
CVS Identification:
$Id: data-procs.tcl,v 1.23.2.18 2023/03/23 15:22:20 antoniop Exp $

Procedures in this file

Detailed information

template::data::transform (public)

 template::data::transform type value_ref

Dispatch procedure for the transform method. "transformation" in template systemspeak means to convert the submitted data to the custom datatype structure, usually a list for complex datatypes, just the value for simple datatypes. The transform method is called after the datatype is validated.

Parameters:
type - The data type to be transformed.
value_ref

Partial Call Graph (max 5 caller/called nodes):
%3

Testcases:
No testcase defined.

template::data::validate (public)

 template::data::validate type value_ref message_ref

This proc invokes the validation code for a given type.

Parameters:
type
value_ref
message_ref
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_boolean validate_boolean (test acs-templating) template::data::validate template::data::validate test_validate_boolean->template::data::validate test_validate_currency validate_currency (test acs-templating) test_validate_currency->template::data::validate test_validate_date validate_date (test acs-templating) test_validate_date->template::data::validate test_validate_email validate_email (test acs-templating) test_validate_email->template::data::validate test_validate_enumeration validate_enumeration (test acs-templating) test_validate_enumeration->template::data::validate template::data::validate::widget template::data::validate::widget (private) template::data::validate->template::data::validate::widget template::data::validate::currency template::data::validate::currency (public) template::data::validate::currency->template::data::validate template::element::validate template::element::validate (private) template::element::validate->template::data::validate

Testcases:
validate_boolean, validate_email, validate_integer, validate_naturalnum, validate_float, validate_number, validate_text, validate_search, validate_file, validate_keyword, validate_filename, validate_url, validate_url_element, validate_date, validate_enumeration, validate_textdate, validate_oneof, validate_currency

template::data::validate::boolean (public)

 template::data::validate::boolean value_ref message_ref

Validates boolean data types.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not
Author:
Roberto Mello

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_boolean validate_boolean (test acs-templating) template::data::validate::boolean template::data::validate::boolean test_validate_boolean->template::data::validate::boolean _ _ (public) template::data::validate::boolean->_

Testcases:
validate_boolean

template::data::validate::date (public)

 template::data::validate::date value_ref message_ref

Validate that a submitted date conforms to the template system's notion of what a date should be.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_date validate_date (test acs-templating) template::data::validate::date template::data::validate::date test_validate_date->template::data::validate::date template::util::date::validate template::util::date::validate (public) template::data::validate::date->template::util::date::validate

Testcases:
validate_date

template::data::validate::email (public)

 template::data::validate::email value_ref message_ref

Validate that a submitted email address is syntactically correct.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_email validate_email (test acs-templating) template::data::validate::email template::data::validate::email test_validate_email->template::data::validate::email _ _ (public) template::data::validate::email->_ util_email_valid_p util_email_valid_p (public) template::data::validate::email->util_email_valid_p

Testcases:
validate_email

template::data::validate::enumeration (public)

 template::data::validate::enumeration value_ref message_ref

Validate enumeration as a unique csv alphanum list.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_enumeration validate_enumeration (test acs-templating) template::data::validate::enumeration template::data::validate::enumeration test_validate_enumeration->template::data::validate::enumeration _ _ (public) template::data::validate::enumeration->_

Testcases:
validate_enumeration

template::data::validate::filename (public)

 template::data::validate::filename value_ref message_ref

Validate that a submitted filename consists of alphanumeric, "_", or "-" characters.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_filename validate_filename (test acs-templating) template::data::validate::filename template::data::validate::filename test_validate_filename->template::data::validate::filename _ _ (public) template::data::validate::filename->_

Testcases:
validate_filename

template::data::validate::float (public)

 template::data::validate::float value_ref message_ref

Validate that a submitted fla contains only an optional sign, and a whole part and fractional part.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_float validate_float (test acs-templating) template::data::validate::float template::data::validate::float test_validate_float->template::data::validate::float _ _ (public) template::data::validate::float->_

Testcases:
validate_float

template::data::validate::integer (public)

 template::data::validate::integer value_ref message_ref

Validate that a submitted integer contains only an optional sign and the digits 0-9.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_integer validate_integer (test acs-templating) template::data::validate::integer template::data::validate::integer test_validate_integer->template::data::validate::integer _ _ (public) template::data::validate::integer->_

Testcases:
validate_integer

template::data::validate::keyword (public)

 template::data::validate::keyword value_ref message_ref

Validate that a submitted keyword consists of alphnumeric or "_" characters.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_keyword validate_keyword (test acs-templating) template::data::validate::keyword template::data::validate::keyword test_validate_keyword->template::data::validate::keyword _ _ (public) template::data::validate::keyword->_

Testcases:
validate_keyword

template::data::validate::naturalnum (public)

 template::data::validate::naturalnum value_ref message_ref

Validates natural numbers data types. Will trim leading 0 in order to avoid Tcl interpreting it as octal (code borrowed from ad_page_contract_filter_proc_naturalnum)

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not
Author:
Rocael Hernandez

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_naturalnum validate_naturalnum (test acs-templating) template::data::validate::naturalnum template::data::validate::naturalnum test_validate_naturalnum->template::data::validate::naturalnum _ _ (public) template::data::validate::naturalnum->_

Testcases:
validate_naturalnum

template::data::validate::nomarkup (public)

 template::data::validate::nomarkup value_ref message_ref

Checks if supplied string contains markup.

Parameters:
value_ref
message_ref
Author:
Guenter Ernst

Partial Call Graph (max 5 caller/called nodes):
%3 _ _ (public) ad_looks_like_html_p ad_looks_like_html_p (public) template::data::validate::nomarkup template::data::validate::nomarkup template::data::validate::nomarkup->_ template::data::validate::nomarkup->ad_looks_like_html_p

Testcases:
No testcase defined.

template::data::validate::number (public)

 template::data::validate::number value_ref message_ref

Validate number - any float - should be any rational number?

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_number validate_number (test acs-templating) template::data::validate::number template::data::validate::number test_validate_number->template::data::validate::number _ _ (public) template::data::validate::number->_

Testcases:
validate_number

template::data::validate::oneof (public)

 template::data::validate::oneof value_ref message_ref

Checks whether the submitted value is contained in the list of values provided via the "-options" parameter of "::template::element::create". If it is set an error is thrown.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_oneof validate_oneof (test acs-templating) template::data::validate::oneof template::data::validate::oneof test_validate_oneof->template::data::validate::oneof _ _ (public) template::data::validate::oneof->_

Testcases:
validate_oneof

template::data::validate::search (public)

 template::data::validate::search value_ref message_ref

It was necessary to declare a datatype of "search" in order for the transformation to be applied correctly. In reality, the transformation should be on the element, not on the datatype. DRB: in practice a template form datatype is defined by the presence of a validate procedure for that type.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1)

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_search validate_search (test acs-templating) template::data::validate::search template::data::validate::search test_validate_search->template::data::validate::search

Testcases:
validate_search

template::data::validate::string (public)

 template::data::validate::string value_ref message_ref

Validate that a submitted string is valid. Hmmm ... all submitted strings are valid, that's easy!

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1)

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_text validate_text (test acs-templating) template::data::validate::string template::data::validate::string test_validate_text->template::data::validate::string

Testcases:
validate_text

template::data::validate::text (public)

 template::data::validate::text value_ref message_ref

Validate that submitted text is valid. Hmmm ... all submitted text is valid, that's easy!

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1)

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_text validate_text (test acs-templating) template::data::validate::text template::data::validate::text test_validate_text->template::data::validate::text template::data::validate::richtext template::data::validate::richtext (public) template::data::validate::richtext->template::data::validate::text template::data::validate::richtext_or_file template::data::validate::richtext_or_file (public) template::data::validate::richtext_or_file->template::data::validate::text

Testcases:
validate_text

template::data::validate::textdate (public)

 template::data::validate::textdate value_ref message_ref

Validate that a submitted textdate if properly formatted.

Parameters:
value_ref - Reference variable to the submitted value.
message_ref - Reference variable for returning an error message.
Returns:
True (1) if valid, false (0) if not.

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_textdate validate_textdate (test acs-templating) template::data::validate::textdate template::data::validate::textdate test_validate_textdate->template::data::validate::textdate _ _ (public) template::data::validate::textdate->_ template::util::date::get_property template::util::date::get_property (public) template::data::validate::textdate->template::util::date::get_property template::util::textdate_localized_format template::util::textdate_localized_format (public) template::data::validate::textdate->template::util::textdate_localized_format

Testcases:
validate_textdate

template::data::validate::time_of_day (public)

 template::data::validate::time_of_day value_ref message_ref

Validate time of day.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_date validate_date (test acs-templating) template::data::validate::time_of_day template::data::validate::time_of_day test_validate_date->template::data::validate::time_of_day template::util::date::validate template::util::date::validate (public) template::data::validate::time_of_day->template::util::date::validate

Testcases:
validate_date

template::data::validate::timestamp (public)

 template::data::validate::timestamp value_ref message_ref

Validate that a submitted date conforms to the template system's notion of what a date should be.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_date validate_date (test acs-templating) template::data::validate::timestamp template::data::validate::timestamp test_validate_date->template::data::validate::timestamp template::util::date::validate template::util::date::validate (public) template::data::validate::timestamp->template::util::date::validate

Testcases:
validate_date

template::data::validate::url (public)

 template::data::validate::url value_ref message_ref

Validate that a submitted url is correct. Accepts an optional http:// or https:// prefix, path, and query string.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_url validate_url (test acs-templating) template::data::validate::url template::data::validate::url test_validate_url->template::data::validate::url _ _ (public) template::data::validate::url->_ util_url_valid_p util_url_valid_p (public) template::data::validate::url->util_url_valid_p

Testcases:
validate_url

template::data::validate::url_element (public)

 template::data::validate::url_element value_ref message_ref

Beautiful URL elements that may only contain lowercase characters, numbers and hyphens.

Parameters:
value_ref - Reference variable to the submitted value
message_ref - Reference variable for returning an error message
Returns:
True (1) if valid, false (0) if not
Author:
Tilmann Singer
See Also:
  • util_text_to_url if you want to offer auto-generation of URLs based on a pretty name

Partial Call Graph (max 5 caller/called nodes):
%3 test_validate_url_element validate_url_element (test acs-templating) template::data::validate::url_element template::data::validate::url_element test_validate_url_element->template::data::validate::url_element _ _ (public) template::data::validate::url_element->_

Testcases:
validate_url_element
[ show source ]