xowiki::Page instproc www-bulk-delete (public)

 <instance of xowiki::Page[i]> www-bulk-delete

Defined in /var/www/openacs.org/packages/xowiki/tcl/xowiki-www-procs.tcl

This web-callable method performs a bulk delete based on the object names provided by the form-variable "objects" and refresh then the caller page. This method is e.g. called by the folder-procs. By passing the "instantiate_p" one can decide whether each item should be instantiated (useful when the delete logic from the whole item ancestry is required), or if we will rely on the cheaper deletion at the package level. The default is false.

Testcases:
No testcase defined.
Source code:
::security::csrf::validate

if {![:exists_form_parameter "objects"]} {
  :msg "nothing to delete"
}

set instantiate_p [:form_parameter instantiate_p:boolean false]

set item_ids [:get_ids_for_bulk_actions [:form_parameter objects:int32,0..n]]
foreach item_id $item_ids {
  :log "bulk-delete: DELETE item_id $item_id"
  if {$instantiate_p} {
    set i [::xo::db::CrClass get_instance_from_db -item_id $item_id]
    $i www-delete
  } else {
    ${:package_id} www-delete -item_id $item_id
  }
}
:return_redirect_without_params
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: