- Publicity: Public Only All
attachments-procs.tcl
Attachments
- Location:
- packages/attachments/tcl/attachments-procs.tcl
- Author:
- Arjun Sanyal <arjun@openforce.net>
- CVS Identification:
$Id: attachments-procs.tcl,v 1.23.2.10 2022/09/12 14:43:22 antoniop Exp $
Procedures in this file
- attachments::add_attachment_url (public)
- attachments::attach (public)
- attachments::context_bar (public)
- attachments::detach_url (public)
- attachments::get_all_attachments (public)
- attachments::get_attachments (public)
- attachments::get_attachments_url (private)
- attachments::get_package_key (public)
- attachments::get_root_folder (public)
- attachments::get_title (public)
- attachments::get_url (public)
- attachments::goto_attachment_url (public)
- attachments::graphic_url (public)
- attachments::map_root_folder (public)
- attachments::root_folder_map_p (public, deprecated)
- attachments::root_folder_p (public)
- attachments::toggle_approved (public)
- attachments::unattach (public)
- attachments::unmap_root_folder (public)
Detailed information
attachments::add_attachment_url (public)
attachments::add_attachment_url [ -folder_id folder_id ] \ [ -package_id package_id ] -object_id object_id \ [ -return_url return_url ] [ -pretty_name pretty_name ]
- Switches:
- -folder_id
(optional)- -package_id
(optional)- -object_id
(required)- -return_url
(optional)- -pretty_name
(optional)- Returns:
- the url that can be used to attach something to an object
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_url_api
attachments::attach (public)
attachments::attach -object_id object_id -attachment_id attachment_id \ [ -approved_p approved_p ]
perform the attachment
- Switches:
- -object_id
(required)- -attachment_id
(required)- -approved_p
(defaults to"t"
) (optional)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_basic_api
attachments::context_bar (public)
attachments::context_bar -folder_id folder_id [ -final final ] \ [ -extra_vars extra_vars ] [ -multirow multirow ]
Create a multirow with cols (url title) for the file-storage bar starting at folder_id
- Switches:
- -folder_id
(required)- -final
(optional)- -extra_vars
(optional)- -multirow
(defaults to"fs_context"
) (optional)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_url_api
attachments::detach_url (public)
attachments::detach_url [ -package_id package_id ] \ -object_id object_id -attachment_id attachment_id \ [ -base_url base_url ] [ -return_url return_url ]
- Switches:
- -package_id
(optional)- -object_id
(required)- -attachment_id
(required)- -base_url
(optional)- -return_url
(optional)- Returns:
- the url to detach an attached item from an object
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_url_api
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 ]
- 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
(boolean) (optional)- 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
(boolean) (optional)- 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
attachments::get_attachments (public)
attachments::get_attachments -object_id object_id \ [ -base_url base_url ] [ -return_url return_url ]
- Switches:
- -object_id
(required)- -base_url
(optional)- -return_url
(optional)- Returns:
- a list of attachment ids and names which are approved: {item_id name url detach_url}
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_basic_api
attachments::get_attachments_url (private)
attachments::get_attachments_url [ -base_url base_url ]
As 'attachments::get_url' returns the value of the attachments package 'RelativeUrl' parameter, which can change at any time, it could happen that previously mounted attachments have a different url and are not found anymore. We try our best here to find a mounted attachments package under 'base_url' to mitigate this, probably flawed, package logic. In the future, probably a better method should be used for URL resolving that is not so broken. The whole thing is even more weird, as the attachments package is currently a singleton that auto-mounts on /attachments, so i am tempted to replace this whole thing with just that, but anyway...
- Switches:
- -base_url
(optional)- The base URL where to look for the attachments package.
- Returns:
- The attachments package URL under 'base_url', or "" if none is found.
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_url_api
attachments::get_package_key (public)
attachments::get_package_key
- Returns:
- the package key (attachments)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_package_key
attachments::get_root_folder (public)
attachments::get_root_folder [ -package_id package_id ]
- Switches:
- -package_id
(optional)- when omitted, will default to the package mounted on the current node's parent.
- Returns:
- the attachment root folder id for the package.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_url_api
attachments::get_title (public)
attachments::get_title -attachment_id attachment_id
- Switches:
- -attachment_id
(required)- ID of the attachment (item_id)
- Returns:
- The title of the attachment (string)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_name_api
attachments::get_url (public)
attachments::get_url
- Returns:
- the value of the RelativeUrl package parameter
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_url_api
attachments::goto_attachment_url (public)
attachments::goto_attachment_url [ -package_id package_id ] \ -object_id object_id -attachment_id attachment_id \ [ -base_url base_url ]
- Switches:
- -package_id
(optional)- -object_id
(required)- -attachment_id
(required)- -base_url
(optional)- Returns:
- the url to go to an attachment
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_url_api
attachments::graphic_url (public)
attachments::graphic_url [ -package_id package_id ]
- Switches:
- -package_id
(optional)- Returns:
- the attachment icon
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_url_api
attachments::map_root_folder (public)
attachments::map_root_folder -package_id package_id \ -folder_id folder_id
Designate a folder as the attachment root folder for a package.
- Switches:
- -package_id
(required)- -folder_id
(required)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_map_folder
attachments::root_folder_map_p (public, deprecated)
attachments::root_folder_map_p -package_id package_id
Deprecated. Invoking this procedure generates a warning.
- Switches:
- -package_id
(required)- Returns:
- 1 if the package_id has an fs_folder mapped to it
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
attachments::root_folder_p (public)
attachments::root_folder_p -package_id package_id
- Switches:
- -package_id
(required)- Returns:
- 1 if the package_id has an fs_folder mapped to it
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_map_folder
attachments::toggle_approved (public)
attachments::toggle_approved -object_id object_id -item_id item_id \ [ -approved_p approved_p ]
toggle approved_p for attachment
- Switches:
- -object_id
(required)- -item_id
(required)- -approved_p
(optional)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_basic_api
attachments::unattach (public)
attachments::unattach -object_id object_id \ -attachment_id attachment_id
undo the attachment
- Switches:
- -object_id
(required)- -attachment_id
(required)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_basic_api
attachments::unmap_root_folder (public)
attachments::unmap_root_folder -package_id package_id \ -folder_id folder_id
Designate a folder as the attachment root folder for a package.
- Switches:
- -package_id
(required)- -folder_id
(required)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_map_folder