Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl,v diff -u -r1.86 -r1.87 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 26 Nov 2009 14:18:47 -0000 1.86 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 11 Mar 2010 11:20:48 -0000 1.87 @@ -121,7 +121,7 @@ } nsv_set site_node_url_by_object_id $object_id $url_by_object_id - if { ![empty_string_p $package_key] } { + if { $package_key ne "" } { set url_by_package_key [list $node(url)] if { [nsv_exists site_node_url_by_package_key $package_key] } { set url_by_package_key [concat [nsv_get site_node_url_by_package_key $package_key] $url_by_package_key] @@ -195,14 +195,14 @@ @author Peter Marklund } { # Create a new node if none was provided and none exists - if { [empty_string_p $node_id] } { + if { $node_id eq "" } { # Default parent node to the main site - if { [empty_string_p $parent_node_id ] } { + if { $parent_node_id eq "" } { set parent_node_id [site_node::get_node_id -url "/"] } # Default node_name to package_key - if { [empty_string_p $node_name] } { + if { $node_name eq "" } { set node_name $package_key } @@ -225,7 +225,7 @@ } # Default context id to the closest ancestor package_id - if { [empty_string_p $context_id] } { + if { $context_id eq "" } { set context_id [site_node::closest_ancestor_package -node_id $node_id] } @@ -271,7 +271,7 @@ nsv_array reset site_node_url_by_package_key [list] set root_node_id [db_string get_root_node_id {} -default {}] - if { ![empty_string_p $root_node_id] } { + if { $root_node_id ne "" } { site_node::update_cache -sync_children -node_id $root_node_id } } @@ -312,7 +312,7 @@ # Find the object_id previously mounted there set cur_object_id $cur_node(object_id) - if { ![empty_string_p $cur_object_id] } { + if { $cur_object_id ne "" } { # Remove the URL from the url_by_object_id entry for that object_id set cur_idx [lsearch -exact $url_by_object_id($cur_object_id) $cur_node_url] if { $cur_idx != -1 } { @@ -323,7 +323,7 @@ # Find the package_key previously mounted there set cur_package_key $cur_node(package_key) - if { ![empty_string_p $cur_package_key] } { + if { $cur_package_key ne "" } { # Remove the URL from the url_by_package_key entry for that package_key set cur_idx [lsearch -exact $url_by_package_key($cur_package_key) $cur_node_url] if { $cur_idx != -1 } { @@ -347,7 +347,7 @@ } db_foreach $query_name {} { - if {[empty_string_p $parent_id]} { + if {$parent_id eq ""} { # url of root node set url "/" } else { @@ -358,14 +358,14 @@ } # save new url set url_by_node_id($node_id) $url - if { ![empty_string_p $object_id] } { + if { $object_id ne "" } { lappend url_by_object_id($object_id) $url } - if { ![empty_string_p $package_key] } { + if { $package_key ne "" } { lappend url_by_package_key($package_key) $url } - if { [empty_string_p $package_id] } { + if { $package_id eq "" } { set object_type "" } else { set object_type "apm_package" @@ -414,15 +414,15 @@ The array elements are: package_id, package_key, object_type, directory_p, instance_name, pattern_p, parent_id, node_id, object_id, url. } { - if {[empty_string_p $url] && [empty_string_p $node_id]} { + if {$url eq "" && $node_id eq ""} { error "site_node::get \"must pass in either url or node_id\"" } - if {![empty_string_p $node_id]} { + if {$node_id ne ""} { return [get_from_node_id -node_id $node_id] } - if {![empty_string_p $url]} { + if {$url ne ""} { return [get_from_url -url $url] } @@ -476,7 +476,7 @@ # attempt adding a / to the end of the url if it doesn't already have # one - if {![string equal [string index $url end] "/"]} { + if {[string index $url end] ne "/" } { append url "/" if {[nsv_exists site_nodes $url]} { return [nsv_get site_nodes $url] @@ -485,14 +485,14 @@ # chomp off part of the url and re-attempt if {!$exact_p} { - while {![empty_string_p $url]} { + while {$url ne ""} { set url [string trimright $url /] set url [string range $url 0 [string last / $url]] if {[nsv_exists site_nodes $url]} { array set node [nsv_get site_nodes $url] - if {[string equal $node(pattern_p) t] && ![empty_string_p $node(object_id)]} { + if {$node(pattern_p) == "t" && $node(object_id) ne ""} { return [array get node] } } @@ -591,7 +591,7 @@ return the site node id associated with the given object_id } { set url [lindex [get_url_from_object_id -object_id $object_id] 0] - if { ![empty_string_p $url] } { + if { $url ne "" } { return [get_node_id -url $url] } else { return {} @@ -625,7 +625,7 @@ set result [list] set array_result_p [string equal $element ""] - while {![string equal $node_id ""]} { + while {$node_id ne "" } { array set node [get -node_id $node_id] if {$array_result_p} { @@ -687,13 +687,13 @@ @author Lars Pind (lars@collaboraid.biz) } { - if { ![empty_string_p $package_type] && ![empty_string_p $package_key] } { + if { $package_type ne "" && $package_key ne "" } { error "You may specify either package_type, package_key, or filter_element, but not more than one." } - if { ![empty_string_p $package_type] } { + if { $package_type ne "" } { lappend filters package_type $package_type - } elseif { ![empty_string_p $package_key] } { + } elseif { $package_key ne "" } { lappend filters package_key $package_key } @@ -729,21 +729,21 @@ if {$elm eq "package_key" && [llength $val] > 1 && [lsearch $val $site_node($elm)] < 0} { set passed_p 0 break - } elseif {($elm ne "package_key" || [llength $val] == 1) && ![string equal $site_node($elm) $val]} { + } elseif {($elm ne "package_key" || [llength $val] == 1) && $site_node($elm) ne $val } { set passed_p 0 break } } if { $passed_p } { - if { ![empty_string_p $element] } { + if { $element ne "" } { lappend return_val $site_node($element) } else { lappend return_val $child_url } } } } - } elseif { ![empty_string_p $element] } { + } elseif { $element ne "" } { set return_val [list] foreach child_url $child_urls { array unset site_node @@ -755,7 +755,7 @@ # if we had filters or were getting a particular element then we # have our results in return_val otherwise it's just urls - if { ![empty_string_p $element] + if { $element ne "" || [llength $filters] > 0} { return $return_val } else { @@ -795,16 +795,16 @@ @author Peter Marklund } { # Make sure we have a url to work with - if { [empty_string_p $url] } { - if { [empty_string_p $node_id] } { + if { $url eq "" } { + if { $node_id eq "" } { set url "/" } else { set url [site_node::get_url -node_id $node_id] } } # should we return the package at the passed-in node/url? - if { $include_self_p && ![empty_string_p $package_key]} { + if { $include_self_p && $package_key ne ""} { array set node_array [site_node::get -url $url] if { [lsearch -exact $package_key $node_array(package_key)] != -1 } { @@ -813,15 +813,15 @@ } set elm_value {} - while { [empty_string_p $elm_value] && $url != "/"} { + while { $elm_value eq "" && $url ne "/"} { # move up a level set url [string trimright $url /] set url [string range $url 0 [string last / $url]] array set node_array [site_node::get -url $url] # are we looking for a specific package_key? - if { [empty_string_p $package_key] || \ + if { $package_key eq "" || \ [lsearch -exact $package_key $node_array(package_key)] != -1 } { set elm_value $node_array($element) } @@ -865,7 +865,7 @@ set existing_urls [site_node::get_children -node_id $parent_node_id -element name] array set parent_node [site_node::get -node_id $parent_node_id] - if { ![empty_string_p $parent_node(package_key)] } { + if { $parent_node(package_key) ne "" } { # Find all the page or directory names under this package foreach path [glob -nocomplain -types d "[acs_package_root_dir $parent_node(package_key)]/www/*"] { lappend existing_urls [lindex [file split $path] end] @@ -881,10 +881,10 @@ } } - if { ![empty_string_p $folder] } { + if { $folder ne "" } { if { [lsearch $existing_urls $folder] != -1 } { # The folder is on the list - if { [empty_string_p $current_node_id] } { + if { $current_node_id eq "" } { # New node: Complain return {} } else { @@ -899,7 +899,7 @@ } } else { # Autogenerate folder name - if { [empty_string_p $instance_name] } { + if { $instance_name eq "" } { error "Instance name must be supplied when folder name is empty." } @@ -953,7 +953,7 @@ db_transaction { site_node::unmount -node_id $node_id - if {[string equal $delete_p t]} { + if {$delete_p == "t"} { site_node::delete -node_id $node_id } } @@ -1014,7 +1014,7 @@ @see site_node::closest_ancestor_package } { - if {[empty_string_p $url]} { + if {$url eq ""} { set url [ad_conn url] } @@ -1027,7 +1027,7 @@ } # Add a trailing slash and try again. - if {[string index $url end] != "/"} { + if {[string index $url end] ne "/"} { append url "/" if {[catch {nsv_get site_nodes $url} result] == 0} { array set node $result @@ -1038,14 +1038,14 @@ } # Try successively shorter prefixes. - while {$url != ""} { + while {$url ne ""} { # Chop off last component and try again. set url [string trimright $url /] set url [string range $url 0 [string last / $url]] if {[catch {nsv_get site_nodes $url} result] == 0} { array set node $result - if {$node(pattern_p) == "t" && $node(object_id) != "" && [lsearch -exact $package_keys $node(package_key)] != -1 } { + if {$node(pattern_p) == "t" && $node(object_id) ne "" && [lsearch -exact $package_keys $node(package_key)] != -1 } { return $node(package_id) } } @@ -1070,7 +1070,7 @@ @see site::node::closest_ancestor_package } { - if {[empty_string_p $package_key]} { + if {$package_key eq ""} { set package_key [subsite::package_keys] } @@ -1079,7 +1079,7 @@ -package_key $package_key \ -url [ad_conn url] ] - if {[empty_string_p $subsite_pkg_id]} { + if {$subsite_pkg_id eq ""} { # No package was found... return the default return $default }