Class ::xowiki::PageTemplate

::xowiki::PageTemplate[i] create ... \
           [ -render_adp (default "0") ]

Defined in

Class Relations

  • class: ::xo::db::CrClass[i]
  • superclass: ::xowiki::Page[i]
  • subclass: ::xowiki::Form[i]
::xo::db::CrClass create ::xowiki::PageTemplate \
     -superclass ::xowiki::Page

Methods (to be applied on the object)

  • count_usages (scripted)

    set publish_status_clause [::xowiki::Includelet publish_status_clause -base_table i $publish_status]
    if {$package_id} {
      set bt "xowiki_page_instancei"
      set package_clause "and object_package_id = :package_id"
    } else {
      set bt "xowiki_page_instance"
      set package_clause ""
    }
    if {$parent_id} {
      set parent_id_clause "and parent_id = :parent_id"
    } else {
      set parent_id_clause ""
    }
    set count [::xo::dc get_value count_usages  "select count(page_instance_id) from $bt, cr_items i   where page_template = :item_id  $publish_status_clause $package_clause $parent_id_clause  and page_instance_id = coalesce(i.live_revision,i.latest_revision)"]
    return $count

Methods (to be applied on instances)

  • anon_instances (setter)

  • count_usages (scripted)

    return [::xowiki::PageTemplate count_usages -package_id $package_id -parent_id $parent_id  -item_id ${:item_id} -publish_status $publish_status]
  • mime_type (setter)

  • page_template_id (setter)

  • render_adp (setter)

  • update (scripted)

    ::xo::dc transaction {
      next
      :instvar object_id anon_instances
      ::xo::dc dml update_xowiki_page_template {update xowiki_page_template
        set anon_instances = :anon_instances where page_template_id = :object_id
      }
    }
  • www-delete (scripted, public)

     <instance of xowiki::PageTemplate[i]> www-delete \
        [ -return_url return_url ]

    This web-callable method deletes a page via the delete method of the package. This method checks first, if there exists still instances of this page (depending on it).

    Switches:
    -return_url (optional)

    Testcases:
    No testcase defined.
    set count [:count_usages -publish_status all]
    #:msg count=$count
    if {$count > 0} {
      append error_msg  [_ xowiki.error-delete_entries_first [list count $count]]  <p>  [:include [list form-usages -publish_status all -parent_id * -form_item_id ${:item_id}]]  </p>
      ${:package_id} error_msg $error_msg
    } else {
      next
    }