Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -r1.95.2.23 -r1.95.2.24 --- openacs-4/packages/acs-tcl/acs-tcl.info 22 Apr 2021 18:47:25 -0000 1.95.2.23 +++ openacs-4/packages/acs-tcl/acs-tcl.info 23 May 2021 17:56:50 -0000 1.95.2.24 @@ -9,7 +9,7 @@ f t - + OpenACS The Kernel Tcl API library. 2017-08-06 @@ -18,7 +18,7 @@ GPL version 2 3 - + Index: openacs-4/packages/acs-tcl/catalog/acs-tcl.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/catalog/acs-tcl.de_DE.ISO-8859-1.xml,v diff -u -r1.21.2.1 -r1.21.2.2 --- openacs-4/packages/acs-tcl/catalog/acs-tcl.de_DE.ISO-8859-1.xml 14 Aug 2019 08:06:29 -0000 1.21.2.1 +++ openacs-4/packages/acs-tcl/catalog/acs-tcl.de_DE.ISO-8859-1.xml 23 May 2021 17:56:51 -0000 1.21.2.2 @@ -45,7 +45,8 @@ %name% ist keine nat�rliche Zahl, die eine ganzzahlige Zahl gr��er oder gleich 0 ist. %name% ist kein g�ltiger SQL Identifikator %name% enth�lt nicht-alphabetische Zeichen - %name% ist keine ganzzahlige Zahl + %name% ist keine ganze Zahl + %name% ist keine g�ltige Objekt-ID %name% ist nicht im Bereich von [%min%, %max%] %name% ist ung�ltig %name% ist zu lang. Bitte geben Sie einen Wert ein, der h�chstens %max_length% Buchstaben hat. Der Wert, den Sie eingegeben haben, ist %actual_length% Buchstaben lang. Index: openacs-4/packages/acs-tcl/catalog/acs-tcl.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/catalog/acs-tcl.en_US.ISO-8859-1.xml,v diff -u -r1.27.2.1 -r1.27.2.2 --- openacs-4/packages/acs-tcl/catalog/acs-tcl.en_US.ISO-8859-1.xml 14 Aug 2019 08:06:29 -0000 1.27.2.1 +++ openacs-4/packages/acs-tcl/catalog/acs-tcl.en_US.ISO-8859-1.xml 23 May 2021 17:56:51 -0000 1.27.2.2 @@ -46,6 +46,7 @@ %name% is not valid %name% is not a valid SQL identifier %name% is not an integer + %name% is not an object_id %name% contains non-word characters %name% contains invalid characters %name% is not in the range [%min%, %max%] Index: openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl,v diff -u -r1.61.2.11 -r1.61.2.12 --- openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl 23 Apr 2021 09:01:31 -0000 1.61.2.11 +++ openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl 23 May 2021 17:56:50 -0000 1.61.2.12 @@ -1559,7 +1559,7 @@ } { A filter rule determines what filters are applied to a given value. The code is passed the name of the formal argument and the list of filters currently being applied, and should - on that basis modify the list of filters to suit its needs. Usually a filter rule will add + on that basis modify the list of filters to suit its needs. Usually, a filter rule will add a certain filter, unless some list of filters are already present.

@@ -1687,6 +1687,34 @@ return 0 } +ad_page_contract_filter object_id { name value } { + + Checks whether the value is a valid object_id, i.e. in the range + defined for the SQL datatype "integer", which is the same for + Oracle and PostgreSQL. In case, object_types are altered in future + versions of OpenACS to e.g. "longinteger", this function has to be + adjusted as well. + + The function is essentially the same as ad_page_contract_filter + "integer", but with the additional value range check. + + @author Gustaf Neumann + @creation-date May 23, 2021 + +} { + if { [regexp {^(-)?(\d+)$} $value _ sign rest] } { + set value $sign[util::trim_leading_zeros $rest] + if {[string is integer -strict $value] + && $value >= -2147483648 + && $value <= 2147483647 } { + return 1 + } + } + ad_complain [_ acs-tcl.lt_name_is_not_an_intege] + return 0 +} + + ad_page_contract_filter range { name value range } { Checks whether the value falls between the specified range. Range must be a list of two elements: min and max. Index: openacs-4/packages/acs-tcl/tcl/test/acs-tcl-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/acs-tcl-test-procs.tcl,v diff -u -r1.71.2.39 -r1.71.2.40 --- openacs-4/packages/acs-tcl/tcl/test/acs-tcl-test-procs.tcl 3 May 2021 09:19:09 -0000 1.71.2.39 +++ openacs-4/packages/acs-tcl/tcl/test/acs-tcl-test-procs.tcl 23 May 2021 17:56:50 -0000 1.71.2.40 @@ -464,6 +464,7 @@ ad_page_contract_filter_proc_naturalnum ad_page_contract_filter_proc_negative_float ad_page_contract_filter_proc_nohtml + ad_page_contract_filter_proc_object_id ad_page_contract_filter_proc_printable ad_page_contract_filter_proc_sql_identifier ad_page_contract_filter_proc_token @@ -481,7 +482,10 @@ dict set cases naturalnum { "1" 1 "-1" 0 "a" 0 "1.2" 0 "'" 0 } dict set cases float { "1" 1 "1.0" 1 "a" 0 "-1.0" 1 "1,0" 0 } dict set cases negative_float { "1" 1 "-1.0" 1 "-a" 0 "-1,0" 0 } - + dict set cases object_id { + "1" 1 "a" 0 "1.2" 0 "'" 0 -1 1 "0x0" 0 + "-2147483648" 1 "2147483647" 1 "-2147483649" 0 "2147483648" 0 + } dict set cases boolean { "1" 1 "-1" 0 "a" 0 "0" 1 "true" 1 "f" 1 "TRUE" 1 "ok" 0 "nok" 0 }