Index: openacs-4/packages/acs-tcl/tcl/table-display-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/table-display-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-tcl/tcl/table-display-procs.tcl 28 Aug 2003 09:41:43 -0000 1.11 +++ openacs-4/packages/acs-tcl/tcl/table-display-procs.tcl 10 Jan 2007 21:22:12 -0000 1.12 @@ -45,15 +45,15 @@ } { set html {} - if {[empty_string_p $option_list]} { + if {$option_list eq ""} { return } - if {[empty_string_p $options_set]} { + if {$options_set eq ""} { set options_set [ns_getform] } - if {[empty_string_p $url]} { + if {$url eq ""} { set url [ad_conn url] } @@ -73,10 +73,10 @@ # check if a default is set otherwise the first value is used set option_key [lindex $option 0] set option_val {} - if { ! [empty_string_p $options_set]} { + if { $options_set ne ""} { set option_val [ns_set get $options_set $option_key] } - if { [empty_string_p $option_val] } { + if { $option_val eq "" } { set option_val [lindex $option 2] } @@ -89,7 +89,7 @@ append html " | " } - if {[string compare $option_val $thisoption] == 0} { + if {$option_val eq $thisoption } { append html "[lindex $option_value 1]" } else { append html "[lindex $option_value 1]" @@ -108,11 +108,11 @@ } { set out {} - if {[empty_string_p $option_list]} { + if {$option_list eq ""} { return } - if {[empty_string_p $options_set]} { + if {$options_set eq ""} { set options_set [ns_getform] } @@ -122,20 +122,20 @@ set option_key [lindex $option 0] set option_val {} # get the option from the form - if { ! [empty_string_p $options_set]} { + if { $options_set ne ""} { set option_val [ns_set get $options_set $option_key] } #otherwise get from default - if { [empty_string_p $option_val] } { + if { $option_val eq "" } { set option_val [lindex $option 2] } foreach option_value [lindex $option 3] { set thisoption [lindex $option_value 0] - if {[string compare $option_val $thisoption] == 0} { + if {$option_val eq $thisoption } { set code [lindex $option_value 2] - if {![empty_string_p $code]} { - if {[string compare [lindex $code 0] $what] == 0} { + if {$code ne ""} { + if {[lindex $code 0] eq $what } { append out " $joiner [uplevel [list subst [lindex $code 1]]]" } } @@ -156,11 +156,11 @@ } { set out {} - if {[empty_string_p $option_list]} { + if {$option_list eq ""} { return } - if {[empty_string_p $options_set]} { + if {$options_set eq ""} { set options_set [ns_getform] } @@ -170,7 +170,7 @@ set option_key [lindex $option 0] set option_val {} # get the option from the form - if { ! [empty_string_p $options_set] && [ns_set find $options_set $option_key] != -1} { + if { $options_set ne "" && [ns_set find $options_set $option_key] != -1} { uplevel [list set $option_key [ns_set get $options_set $option_key]] } else { uplevel [list set $option_key [lindex $option 2]] @@ -290,7 +290,7 @@ set Tform [ad_conn form] # export variables from calling environment - if {![empty_string_p $Textra_vars]} { + if {$Textra_vars ne ""} { foreach Tvar $Textra_vars { upvar $Tvar $Tvar } @@ -300,14 +300,14 @@ set Torderbykey {::not_sorted::} set Treverse {} regexp {^([^*,]+)([*])?} $Torderby match Torderbykey Treverse - if {$Treverse == "*"} { + if {$Treverse eq "*"} { set Torder desc } else { set Torder asc } # set up the target url for new sorts - if {[empty_string_p $Torder_target_url]} { + if {$Torder_target_url eq ""} { set Torder_target_url [ad_conn url] } set Texport "[uplevel [list export_ns_set_vars url [list orderby$Tsuffix]]]&" @@ -325,7 +325,7 @@ # generate the header code # append Theader "\n" - if {[empty_string_p $Theader_row_extra]} { + if {$Theader_row_extra eq ""} { append Theader "\n" } else { append Theader "\n" @@ -334,18 +334,18 @@ set Tcol [lindex $Tdatadef $Ti] if { ( [ns_set find $selection [lindex $Tcol 0]] < 0 && ([empty_string_p [lindex $Tcol 2]] || - ([string compare [lindex $Tcol 2] "sort_by_pos"] != 0) + ([lindex $Tcol 2] ne "sort_by_pos" ) ) ) - || [string compare [lindex $Tcol 2] no_sort] == 0 + || [lindex $Tcol 2] eq "no_sort" } { # not either a column in the select or has sort code # then just a plain text header so do not do sorty things append Theader " \n" } else { - if {[string compare [lindex $Tcol 0] $Torderbykey] == 0} { - if {$Torder == "desc"} { + if {[lindex $Tcol 0] eq $Torderbykey } { + if {$Torder eq "desc"} { set Tasord $Tasc_order_img } else { set Tasord $Tdesc_order_img @@ -379,7 +379,7 @@ if { $Tpost_data && $Tpost_data <= [llength $Tpost_data_ns_sets] } { # bind the Tpost_data_ns_sets row of the passed in data - set_variables_after_query_not_selection [lindex $Tpost_data_ns_sets [expr $Tpost_data - 1]] + set_variables_after_query_not_selection [lindex $Tpost_data_ns_sets [expr {$Tpost_data - 1}]] } elseif { $Tpost_data } { # past the end of the fake data drop out. break @@ -402,10 +402,10 @@ # first check if we are in audit mode and if the audit columns have changed set Tdisplay_changes_only 0 - if {![empty_string_p $Taudit] && $Tcount > 0} { + if {$Taudit ne "" && $Tcount > 0} { # check if the audit key columns changed foreach Taudit_key $Taudit { - if {[string compare [set $Taudit_key] [set P$Taudit_key]] == 0} { + if {[set $Taudit_key] eq [set P$Taudit_key] } { set Tdisplay_changes_only 1 } } @@ -468,7 +468,7 @@ } if { $Tdisplay_changes_only - && [string compare $Tdisplay_field $Tlast_display($Ti)] == 0} { + && $Tdisplay_field eq $Tlast_display($Ti) } { set Tdisplay_field {} } else { set Tlast_display($Ti) $Tdisplay_field @@ -482,7 +482,7 @@ # so on next row we can say things like if $Pvar != $var not blank if { $Tpost_data && $Tpost_data <= [llength $Tpost_data_ns_sets] } { # bind the Tpost_data_ns_sets row of the passed in data - set_variables_after_query_not_selection [lindex $Tpost_data_ns_sets [expr $Tpost_data - 1]] P + set_variables_after_query_not_selection [lindex $Tpost_data_ns_sets [expr {$Tpost_data - 1}]] P } else { set_variables_after_query_not_selection $selection P } @@ -511,21 +511,21 @@ -sortable from t/f/all } { set column_list {} - if {[empty_string_p $columns]} { + if {$columns eq ""} { for {set i 0} {$i < [llength $datadef]} {incr i} { - if {$sortable == "all" - || ($sortable == "t" && [lindex [lindex $datadef $i] 2] != "no_sort") - || ($sortable == "f" && [lindex [lindex $datadef $i] 2] == "no_sort") + if {$sortable eq "all" + || ($sortable eq "t" && [lindex [lindex $datadef $i] 2] != "no_sort") + || ($sortable eq "f" && [lindex [lindex $datadef $i] 2] == "no_sort") } { lappend column_list $i } } } else { set colnames {} foreach col $datadef { - if {$sortable == "all" - || ($sortable == "t" && [lindex $col 2] != "no_sort") - || ($sortable == "f" && [lindex $col 2] == "no_sort") + if {$sortable eq "all" + || ($sortable eq "t" && [lindex $col 2] ne "no_sort") + || ($sortable eq "f" && [lindex $col 2] eq "no_sort") } { lappend colnames [lindex $col 0] } else { @@ -594,32 +594,32 @@ set n_sel_columns [llength $sel_columns] set html {} - if {[string compare $item "CreateNewCustom"] == 0} { + if {$item eq "CreateNewCustom" } { set item {} } # now spit out the form fragment. - if {![empty_string_p $item]} { + if {$item ne ""} { append html "

Editing $item

" append html "" append html "" append html "" append html "[export_form_vars item_group item]" - if {![empty_string_p $return_url]} { + if {$return_url ne ""} { append html "[export_form_vars return_url]" } append html "" } append html "" - if {![empty_string_p $return_url]} { + if {$return_url ne ""} { append html "[export_form_vars return_url]" } - if {[empty_string_p $item_group]} { + if {$item_group eq ""} { set item_group [ad_conn url] } append html "[export_form_vars item_group]" - if {![empty_string_p $item]} { + if {$item ne ""} { set item_original $item append html "[export_form_vars item_original]" append html "" @@ -629,13 +629,13 @@ append html "
[lindex $Tcol 1] 
" append html "" - if {![empty_string_p $item]} { + if {$item ne ""} { set item_original item append html "[export_form_vars item_original]" append html "" } - if {[string compare $type select] == 0} { + if {$type eq "select" } { # select table set options "" foreach opt $sel_list { @@ -649,7 +649,7 @@ } else { set out $options } - append html "\n" + append html "\n" } } else { # radio button table @@ -670,7 +670,7 @@ set out $options } regsub -all {@@} $out $i out - append html "$out\n" + append html "$out\n" } } append html "
Name:
 Editing the name will rename the view
[expr $i + 1]
[expr {$i + 1}]
[expr $i + 1]
[expr {$i + 1}]
" @@ -706,7 +706,7 @@ set direction [list] foreach col $full_column { regexp {([^*,]+)([*])?} $col match coln dirn - if {$dirn == "*"} { + if {$dirn eq "*"} { set dirn desc } else { set dirn asc @@ -719,32 +719,32 @@ set n_sel_columns [llength $sel_columns] set html {} - if {[string compare $item "CreateNewCustom"] == 0} { + if {$item eq "CreateNewCustom" } { set item {} } # now spit out the form fragment. - if {![empty_string_p $item]} { + if {$item ne ""} { append html "

Editing $item

" append html "
" append html "" append html "" append html "[export_form_vars item_group item]" - if {![empty_string_p $return_url]} { + if {$return_url ne ""} { append html "[export_form_vars return_url]" } append html "
" } append html "
" - if {![empty_string_p $return_url]} { + if {$return_url ne ""} { append html "[export_form_vars return_url]" } - if {[empty_string_p $item_group]} { + if {$item_group eq ""} { set item_group [ad_conn url] } append html "[export_form_vars item_group]" - if {![empty_string_p $item]} { + if {$item ne ""} { set item_original $item append html "[export_form_vars item_original]" append html "" @@ -754,7 +754,7 @@ append html "" append html "" - if {![empty_string_p $item]} { + if {$item ne ""} { set item_original item append html "[export_form_vars item_original]" append html "" @@ -772,7 +772,7 @@ } else { set out $options } - append html "
Name:
 Editing the name will rename the sort
[expr $i + 1]" + append html "
[expr {$i + 1}]" switch [lindex $direction $i] { asc { append html "" @@ -800,20 +800,20 @@ # if there's a "*" after the key, we want to reverse the usual order foreach order_spec $tabledef { if { $sort_key == [lindex $order_spec 0] } { - if { $reverse == "*" } { + if { $reverse eq "*" } { set order "desc" } else { set order "asc" } - if { $order_by_clause == "" } { + if { $order_by_clause eq "" } { append order_by_clause "\norder by " } else { append order_by_clause ", " } # tack on the order by clause - if {![empty_string_p [lindex $order_spec 2]] && ([string compare [lindex $order_spec 2] "sort_by_pos"] != 0)} { + if {![empty_string_p [lindex $order_spec 2]] && ([lindex $order_spec 2] ne "sort_by_pos" )} { append order_by_clause "[subst [lindex $order_spec 2]]" } else { append order_by_clause "$sort_key $order" @@ -838,12 +838,12 @@ sort key to reorder, the things which have the same value for the newly-sorted column will remain in the same relative order. } { - if { $keys == "" } { + if { $keys eq "" } { return $key } elseif { [regexp "^${key}(\\*?)," "$keys," match reverse] } { # if this was already the first key, then reverse order - if { $reverse == "*" } { + if { $reverse eq "*" } { regsub "\\*," "$keys," "," keys } else { regsub "," "$keys," "*," keys @@ -860,7 +860,7 @@ proc_doc ad_same_page_link {variable value text {form ""}} { Makes a link to this page, with a new value for "variable". } { - if { [empty_string_p $form] } { + if { $form eq "" } { set form [ns_getform] } set url_vars [export_ns_set_vars url $variable $form] @@ -913,7 +913,7 @@ set break {} foreach item $items { - if {[string compare $item_set $item] == 0} { + if {$item_set eq $item } { append html "$break$item (edit)" } else { append html "$break$item" @@ -931,8 +931,8 @@ empty do a returnredirect with the defaults set } { set form [ns_getform] - if {[empty_string_p $form] - && ![empty_string_p $defaults]} { + if {$form eq "" + && $defaults ne ""} { # we did not get a form so set all the variables # and redirect to set them set redirect "[ad_conn url]?" @@ -958,10 +958,10 @@ sets up the head of a form to feed to /tools/form-custom.tcl } { append html "\n" - if {![empty_string_p $return_url]} { + if {$return_url ne ""} { append html "[export_form_vars return_url]\n" } - if {[empty_string_p $item_group]} { + if {$item_group eq ""} { set item_group [ad_conn url] } set item_original $item @@ -979,14 +979,14 @@ append html "
[lindex $opt 1]" append html "