Object ::xowiki::autoname (public)
::xotcl::Object ::xowiki::autoname
Defined in
- Testcases:
-
No testcase defined.
Source code:
namespace eval ::xowiki {}
::nsf::object::alloc ::xotcl::Object ::xowiki::autoname {}
::xowiki::autoname proc basename name {
file rootname $name
}
::xowiki::autoname proc new {-parent_id -name} {
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
}
}
}
::xowiki::autoname proc generate {-parent_id -name} {
::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
}
namespace eval ::xowiki {::namespace export Menu YUIMenuBar YUIMenuBarItem YUIMenu YUIMenuItem YUIMenuItemList YUIContextMenu YUIContextMenuItem}
XQL Not present:Generic, PostgreSQL, Oracle
[
hide source ]
| [
make this the default ]