| |
716 |
716 |
if { [template::util::is_nil value] } { |
| |
717 |
717 |
return $value_if_null |
| |
718 |
718 |
} else { |
| |
719 |
719 |
return $value |
| |
720 |
720 |
} |
| |
721 |
721 |
} |
| |
722 |
722 |
|
| |
723 |
723 |
ad_proc -public template::util::number_list { last_number {start_at 0} } { |
| |
724 |
724 |
Return a list of numbers, {1 2 3 ... n} |
| |
725 |
725 |
} { |
| |
726 |
726 |
|
| |
727 |
727 |
set ret [list] |
| |
728 |
728 |
for {set i $start_at} { $i <= $last_number } {incr i} { |
| |
729 |
729 |
lappend ret $i |
| |
730 |
730 |
} |
| |
731 |
731 |
return $ret |
| |
732 |
732 |
} |
| |
733 |
733 |
|
| |
734 |
734 |
ad_proc -public template::util::tcl_to_sql_list { lst } { |
| |
735 |
735 |
Convert a TCL list to a SQL list, for use with the "in" statement |
| |
736 |
|
why doesn't this use ns_dbquotevalue? |
| |
|
736 |
This functions uses DoubleApos (similar to ns_dbquotevalue) functionality to escape single quotes |
| |
737 |
737 |
} { |
| |
738 |
738 |
|
| |
739 |
739 |
if { [llength $lst] > 0 } { |
| |
|
740 |
# adding DoubleApos functionality for security reasons. |
| |
|
741 |
regsub -all -- ' "$lst" '' lst2 |
| |
740 |
742 |
set sql "'" |
| |
741 |
|
append sql [join $lst "', '"] |
| |
|
743 |
append sql [join $lst2 "', '"] |
| |
742 |
744 |
append sql "'" |
| |
743 |
745 |
return $sql |
| |
744 |
746 |
} else { |
| |
745 |
747 |
return "" |
| |
746 |
748 |
} |
| |
747 |
749 |
} |
| |
748 |
750 |
|
| |
749 |
751 |
|
| |
750 |
752 |
|
| |
751 |
753 |
ad_proc -public template::get_resource_path {} { |
| |
752 |
754 |
Get the template directory |
| |
753 |
755 |
The body is doublequoted, so it is interpreted when this file is read |
| |
754 |
756 |
} " |
| |
755 |
757 |
return \"[file dir [file dir [info script]]]/resources\" |
| |
756 |
758 |
" |
| |
757 |
759 |
|
| |
758 |
760 |
|
| |
759 |
761 |
|
| |
760 |
762 |
ad_proc -public stack_frame_values {level} { |
| |
761 |
763 |
return the variables and arrays of one frame as HTML |