Defined in
Class Relations
- class: ::xotcl::Object
::xotcl::Object create ::xowiki::autoname
Methods (to be applied on the object)
xowiki::autoname basename
- Testcases:
-
create_workflow_with_instance, xowf
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)
xowiki::autoname new
- Testcases:
-
create_workflow_with_instance, xowf
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
}
}