"
+ return $text
+ }
+
+ proc titleEntry {txt {align "left"} {extra ""}} {
+ return "$txt | "
+ }
+
+ proc titleSortEntry {txt url {align "left"} {extra ""}} {
+ return "$txt | "
+ }
+
+ proc ui_columns {cell_list {tableoptions ""}} {
+ set cell_start ""
+ return "$cell_start[join $cell_list "$cell_start"] "
+ }
+
+ proc ui_equal_columns {cell_list {width 100%}} {
+ set cell_width [expr 100 / [llength $cell_list]]
+ set cell_start " | "
+ return "$cell_start[join $cell_list "$cell_start"] "
+ }
+ proc is_number {text} {
+ regexp {[0-9]*\.[0-9]*} $text match
+ return [info exist match]
+ }
+
+
+ ##
+ ## sortable table procs
+ ##
+
+ proc setTitle {table_name table_title} {
+ upvar $table_name\_title title
+ set title $table_title
+ }
+
+ proc setForm {table_name action_url {options ""}} {
+ upvar $table_name\_form form_action_url
+ regexp {.*-file.*} $options match
+ if {[info exists match]} {
+ set form_action_url "action=$action_url enctype=multipart/form-data method=post"
+ } else {
+ set form_action_url "action=$action_url method=post"
+ }
+ }
+
+ proc setColumnHeadings {table_name heading_list} {
+ upvar $table_name\_headings headings
+ upvar $table_name\_max_columns max_columns
+ set headings $heading_list
+ if {![info exist max_columns]} {set max_columns 0}
+ if {[llength $heading_list] > $max_columns} {
+ set max_columns [llength $heading_list]
+ }
+ }
+
+ proc setColumnAlignment {table_name align_list} {
+ ns_log notice "set align list to $align_list"
+ upvar $table_name\_aligns aligns
+ set aligns $align_list
+ }
+
+ proc setColumnWidths {table_name width_list} {
+ upvar $table_name\_widths widths
+ set widths $width_list
+ }
+
+ proc setExportVars {table_name vars} {
+ upvar $table_name\_export_vars table_export_vars
+ set table_export_vars "$vars&"
+ }
+
+ # addSortableRow
+ # table_name is the name of the table we are creating
+ # row is a list of the row elements
+ proc addSortableRow {table_name row} {
+ upvar $table_name the_table
+ upvar $table_name\_max_columns max_columns
+ if {![info exists the_table]} {
+ # set the_table ""
+ }
+ set the_table [lappend the_table $row]
+
+ if {![info exist max_columns]} {set max_columns 0}
+ if {[llength $row] > $max_columns} {
+ set max_columns [llength $row]
+ }
+ }
+
+ proc addUnsortedRow {table_name row} {
+ upvar $table_name\_unsorted unsorted
+ upvar $table_name\_max_columns max_columns
+ set unsorted [lappend unsorted $row]
+
+ if {![info exist max_columns]} {set max_columns 0}
+ if {[llength $row] > $max_columns} {
+ set max_columns [llength $row]
+ }
+ }
+
+ proc outputTable {table_name {table_title ""} {width "100%"}} {
+ # _sort_column and _sort_order should exist
+ # otherwise no sorting
+
+ upvar $table_name\_sort_column sort_column
+ upvar $table_name\_sort_order sort_order
+ upvar $table_name the_table
+ upvar $table_name\_unsorted unsorted
+ upvar $table_name\_title the_title
+ upvar $table_name\_headings headings
+ upvar $table_name\_aligns aligns
+ upvar $table_name\_widths widths
+ upvar $table_name\_form form_action_url
+ upvar $table_name\_max_columns max_columns
+ upvar $table_name\_export_vars table_export_vars
+
+ if {![info exists sort_column]} {
+ set sort_column 0
+ }
+ if {![info exists sort_order]} {
+ set sort_order increasing
+ }
+ # kludge until all tables are updated for titling...
+ if {[info exists the_title]} {
+ set table_title $the_title
+ }
+ if {![info exists table_export_vars]} {
+ set table_export_vars ""
+ }
+ initColors
+
+ if {![info exists the_table] && ![info exists unsorted]} {
+ return "
+ [startTable $table_title "$width"]
+ [newRow]
+ | No data. |
+ [endRow]\n
+ [endTable]"
+ }
+
+ # sort
+ ad_page_variables "\"$table_name\_sort_column 0\" \"$table_name\_sort_order increasing\""
+ if {[info exists the_table]} {
+ set the_table [lsort -dictionary -[set $table_name\_sort_order] -index [set $table_name\_sort_column] $the_table]
+ }
+
+ if {[info exists form_action_url]} {
+ append txt ""
+ }
+ return $txt
+ }
+
+}