attachments::get_all_attachments (public)
attachments::get_all_attachments -object_id object_id \ [ -base_url base_url ] [ -return_url return_url ] \ [ -approved_only ] [ -add_detach_url ]
Defined in packages/attachments/tcl/attachments-procs.tcl
- Switches:
- -object_id (required)
- object to check for attachments.
- -base_url (optional)
- URL path that will be prepended to generated URLs.
- -return_url (optional)
- only meaningful if we are also generating detach_url, is the location we will return to after detaching.
- -approved_only (optional, boolean)
- flag deciding if we want to return only attachments that have been approved. All attachments will be returned when this is not specified.
- -add_detach_url (optional, boolean)
- flag deciding whether we want to generate also detach_url in the result.
- Returns:
- a list representing attachments and their UI URLs.
list of lists in the format {item_id name url} or {item_id name url detach_url} whenadd_detach_url
is specified.- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_basic_api
Source code: set lst_with_urls [list] foreach item_id [db_list_of_lists select_attachments { select item_id from attachments where object_id = :object_id and (not :approved_only_p or approved_p)}] { # # Set the attachment 'label' # set label [attachments::get_title -attachment_id $item_id] # # Set the attachment URL # set url [goto_attachment_url -object_id $object_id -attachment_id $item_id -base_url $base_url] set element [list $item_id $label $url] if {$add_detach_url_p} { lappend element [detach_url -object_id $object_id -attachment_id $item_id -base_url $base_url -return_url $return_url] } lappend lst_with_urls $element } return $lst_with_urlsXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/attachments/tcl/attachments-procs.xql