xotcl.wu-wien.ac.at
Begin main content
Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]

::xotcl::Object[i] ::xowiki::autoname

::xotcl::Object create ::xowiki::autoname

Methods

  • proc basename

    ::2449635 proc basename name {
        # In case the provided name has an extension, return the name
        # without it.
        file rootname $name
      }
    
  • proc generate

    ::2449635 proc generate {-parent_id -name} {
        db_transaction {
          set already_recorded [::xo::db_0or1row autoname_query {
    	select count from xowiki_autonames
    	where parent_id = :parent_id and name = :name}]
          
          if {$already_recorded} {
            incr count
            db_dml [my qn update_autoname_counter]  "update xowiki_autonames set count = count + 1  where parent_id = :parent_id and name = :name"
          } else {
            set count 1
            db_dml [my qn insert_autoname_counter]  "insert into xowiki_autonames (parent_id, name, count)  values (:parent_id, :name, $count)"
          }
        }
        return $name$count
      }
    
  • proc new

    ::2449635 proc new {-parent_id -name} {
        while {1} {
          set generated_name [my 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: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]