site_node::verify_folder_name (public)
site_node::verify_folder_name -parent_node_id parent_node_id \ [ -current_node_id current_node_id ] \ [ -instance_name instance_name ] [ -folder folder ]
Defined in packages/acs-tcl/tcl/site-nodes-procs.tcl
Verifies that the given folder name is valid for a folder under the given parent_node_id. If current_node_id is supplied, it's assumed that we're renaming an existing node, not creating a new one. If folder name is not supplied, we'll generate one from the instance name, which must then be supplied.
- Switches:
- -parent_node_id (required)
- -current_node_id (optional)
- -instance_name (optional)
- -folder (optional)
- Returns:
- folder name, or empty string if the supplied folder name wasn't acceptable.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- site_node_verify_folder_name
Source code: 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 { $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 [ad_file split $path] end] } foreach path [glob -nocomplain -types f "[acs_package_root_dir $parent_node(package_key)]/www/*.adp"] { lappend existing_urls [file rootname [lindex [ad_file split $path] end]] } foreach path [glob -nocomplain -types f "[acs_package_root_dir $parent_node(package_key)]/www/*.tcl"] { set name [file rootname [lindex [ad_file split $path] end]] if { $name ni $existing_urls } { lappend existing_urls $name } } } if { $folder ne "" } { if { $folder in $existing_urls } { # The folder is on the list if { $current_node_id eq "" } { # New node: Complain return {} } else { # Renaming an existing node: Check to see if the node is merely conflicting with itself set parent_url [site_node::get_url -node_id $parent_node_id] set new_node_url "$parent_url$folder" if { ![site_node::exists_p -url $new_node_url] || $current_node_id != [site_node::get_node_id -url $new_node_url] } { return {} } } } } else { # Autogenerate folder name if { $instance_name eq "" } { error "Instance name must be supplied when folder name is empty." } set folder [util_text_to_url -existing_urls $existing_urls -text $instance_name] } return $folderGeneric XQL file: packages/acs-tcl/tcl/site-nodes-procs.xql
PostgreSQL XQL file: packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql
Oracle XQL file: packages/acs-tcl/tcl/site-nodes-procs-oracle.xql