- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class Relations
::xotcl::Object create ::xowiki::autoname
Methods (to be applied on the object)
basename (scripted, public)
xowiki::autoname
basename nameReturn the name with its final file extension removed.
- Parameters:
- name (required)
- Name to process.
- Testcases:
- create_workflow_with_instance
# In case the provided name has an extension, return the name # without it. file rootname $name
generate (scripted)
::xo::dc transaction { set already_recorded [::xo::dc 0or1row autoname_query { select count from xowiki_autonames where parent_id = :parent_id and name = :name}] if {$already_recorded} { incr count ::xo::dc dml update_autoname_counter "update xowiki_autonames set count = count + 1 where parent_id = :parent_id and name = :name" } else { set count 1 ::xo::dc dml insert_autoname_counter "insert into xowiki_autonames (parent_id, name, count) values (:parent_id, :name, $count)" } } return $name$count
new (scripted, public)
xowiki::autoname
new [ -parent_id parent_id ] [ -name name ]Generate names until one is available under the given parent.
- Switches:
- -parent_id (optional)
- ID of the parent item.
- -name (optional)
- Base name for the generated name.
- Returns:
- An unused name.
- Testcases:
- create_workflow_with_instance
while {1} { set generated_name [:generate -parent_id $parent_id -name $name] if {[::xo::db::CrClass lookup -name $generated_name -parent_id $parent_id] eq "0"} { return $generated_name } }
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables