The syntax is not conformant to the tag definitions [1]. I think it was silently introduced a view years ago. There is/was a large variety of styles of Boolean comparison in adp-files, many of those variants were cleaned up, made explicit over the last years [2]. It is not clear, what <if @item_id@> should mean: is it empty (as you suggest? is it non-zero? or is the variable set? So, making these tests explicit helps to understand the code and improves maintainability. Probably, the example above should raise an error/warning, since it is not covered by the OpenACS tag expression rules. I will look into this, when time permits.
If there are many such places in your code basis, you might find the following script helpful for detecting/fixes such cases. Although this script covers for the Boolean cases, it is straightforward to include item_id tests similar as in rule 1. The script works through all the .adp files in the current directory (pr below).
btw,.i would not recommend to upgrade to the beta version (5.9.1b3), but to upgrade to the released version OpenACS 5.9.1.
all the best
-gn
[1] https://openacs.org/doc/acs-templating/tagref/if
[2] https://cvs.openacs.org/qsearch?q=boolean+tag&t=1&project=
#!/usr/bin/env tclsh
# script to change boolean tags
# Gustaf Neumann, Dez 2010
array set opt {-reset 0 -change 1 -path . -name *adp -diff 0}
array set opt $argv
if {$opt(-reset)} {
foreach file [exec find -L $opt(-path) -type f -name *-original] {
regexp {^(.*)-original} $file _ new
file delete $new
file rename $file $new
}
}
if {$opt(-diff)} {
foreach file [exec find -L $opt(-path) -type f -name *-original] {
regexp {^(.*)-original} $file _ new
set status [catch {exec diff -wu $file $new} result]
puts "---diff -wu $file $new"
puts $result
}
exit
}
if {$opt(-change)} {
set totalchanges 0
set files 0
foreach file [exec find -L $opt(-path) -type f -name $opt(-name)] {
puts processing-$file
set F [open $file]; set c [read $F]; close $F
set origContent $c
set newFile ""
set changes 0
incr changes [regsub -all {<if @([a-zA-Z0-9_.]+_p)@>} $c {<if @\1;literal@ true>} c]
incr changes [regsub -all {<if @([a-zA-Z0-9_.]+_p)@ eq ("t"|t|"1"|1)>} $c {<if @\1;literal@ true>} c]
incr changes [regsub -all {<if @([a-zA-Z0-9_.]+_p)@ eq ("f"|f|"0"|0)>} $c {<if @\1;literal@ false>} c]
incr changes [regsub -all {<if @([a-zA-Z0-9_.]+_p)@ (true|false)>} $c {<if @\1;literal@ \2>} c]
if {$changes > 0} {
puts "... updating $file ($changes changes)"
set F [open /tmp/XXX w]; puts -nonewline $F $c; close $F
file rename $file $file-original
set F [open $file w]; puts -nonewline $F $c; close $F
incr totalchanges $changes
incr files
}
}
puts "$totalchanges changes in $files files"
}