Index: openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl 27 Jul 2006 00:42:52 -0000 1.8 +++ openacs-4/packages/acs-subsite/tcl/attribute-procs.tcl 10 Jan 2007 21:22:06 -0000 1.9 @@ -59,7 +59,7 @@ specified name. 0 otherwise } { - if { $convert_p == "t" } { + if { $convert_p eq "t" } { set attribute [plsql_utility::generate_oracle_name $orig_attribute] } else { set attribute $orig_attribute @@ -77,7 +77,7 @@ from dual }] - if { $attr_exists_p || $convert_p == "f" } { + if { $attr_exists_p || $convert_p eq "f" } { # If the attribute exists, o return $attr_exists_p } @@ -153,7 +153,7 @@ # execute drop statements until we reach position $i+1 # This position represents the operation on which we failed, and thus # is not executed - for { set inner [expr [llength $plsql_drop] - 1] } { $inner > [expr $i + 1] } { set inner [expr $inner - 1] } { + for { set inner [expr {[llength $plsql_drop] - 1}] } { $inner > [expr {$i + 1}] } { set inner [expr {$inner - 1}] } { set drop_pair [lindex $plsql_drop $inner] if { [catch {eval [lindex $drop_pair 2] [lindex $drop_pair 0] [lindex $drop_pair 1]} err_msg_2] } { append err_msg "\nAdditional error while trying to roll back: $err_msg_2" @@ -210,7 +210,7 @@ set sql "$type" - if { ![empty_string_p $default] } { + if { $default ne "" } { # This is also pretty nasty - we have to make sure we # treat db literals appropriately - null is much different # than 'null' - mbryzek @@ -220,7 +220,7 @@ } append sql " default $default" } - if { ![empty_string_p $constraint] } { + if { $constraint ne "" } { append sql " constraint $constraint" } return $sql @@ -252,7 +252,7 @@ # Attribute doesn't exist return 0 } - if { [empty_string_p $table_name] || [empty_string_p $column_name] } { + if { $table_name eq "" || $column_name eq "" } { # We have to have both a non-empty table name and column name error "We do not have enough information to automatically remove this attribute. Namely, we are missing either the table name or the column name" } @@ -379,10 +379,10 @@ @creation-date 12/2000 } { - if { [string eq $datatype "date"] } { + if {$datatype eq "date"} { return 0 } - if { [string eq $datatype "enumeration"] } { + if {$datatype eq "enumeration"} { return 1 } if { [empty_string_p [info procs "::template::data::validate::$datatype"]] } { @@ -437,7 +437,7 @@ set storage_clause "" - if {![empty_string_p $include_storage_types]} { + if {$include_storage_types ne ""} { set storage_clause " and a.storage in ('[join $include_storage_types "', '"]')" } @@ -464,7 +464,7 @@ set attr_props(datatype:$name) $datatype set attr_props(id:$name) $attribute_id } - if { [string eq $datatype "enumeration"] } { + if {$datatype eq "enumeration"} { set enum_values($name:$enum_value) $value_pretty_name } } @@ -487,13 +487,13 @@ upvar $datasource_name attributes - if {[empty_string_p $object_type]} { + if {$object_type eq ""} { set object_type [db_string object_type_query { select object_type from acs_objects where object_id = :object_id }] } - if {[empty_string_p $return_url]} { + if {$return_url eq ""} { set return_url "[ad_conn url]?[ad_conn query]" } @@ -519,7 +519,7 @@ foreach key $attr_list { set col_value [set $key] set attribute_id $attr_props(id:$key) - if { [string eq $attr_props(datatype:$key) "enumeration"] && [info exists enum_values($key:$col_value)] } { + if { $attr_props(datatype:$key) eq "enumeration" && [info exists enum_values($key:$col_value)] } { # Replace the value stored in the column with the # pretty name for that attribute set col_value $enum_values($key:$col_value) @@ -546,15 +546,15 @@ @param variable_prefix Variable prefix. } { - if {[empty_string_p $form_id]} { + if {$form_id eq ""} { error "attribute::add_form_elements - form_id not specified" } - if {[empty_string_p $object_type]} { + if {$object_type eq ""} { error "attribute::add_form_elements - object type not specified" } - if {![empty_string_p $variable_prefix]} { + if {$variable_prefix ne ""} { append variable_prefix "." } @@ -572,15 +572,15 @@ set required_p [lindex $row 5] set default [lindex $row 6] - if { [string eq $datatype "enumeration"] } { + if {$datatype eq "enumeration"} { # For enumerations, we generate a select box of all the possible values set option_list [db_list_of_lists select_enum_values { select enum.pretty_name, enum.enum_value from acs_enum_values enum where enum.attribute_id = :attribute_id order by enum.sort_order }] - if { [string eq $required_p "f"] } { + if {$required_p eq "f"} { # This is not a required option list... offer a default lappend option_list [list " (no value) " ""] }