forum::markdown_image::attach (private)
forum::markdown_image::attach forum_id message_id drafts
Defined in packages/forums/tcl/markdown-image-procs.tcl
Import staged images through the Forums content repository attachment workflow.
- Parameters:
- forum_id (required)
- message_id (required)
- drafts (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: if {[dict size $drafts] == 0} { return } set folder_id [content::item::get_id -root_folder_id $forum_id -item_path attachments] if {$folder_id eq ""} { set folder_id [content::item::new -parent_id $forum_id -name attachments] } dict for {uuid image} $drafts { if {[attachment $message_id $uuid] ne ""} { continue } lassign $image path mime set item_id [content::item::new -name markdown-$message_id-$uuid -title "Pasted image.[lindex [split $mime /] 1]" -parent_id $folder_id -context_id $message_id -creation_user [ad_conn user_id] -creation_ip [ad_conn peeraddr] -package_id [ad_conn package_id] -storage_type file -tmp_filename $path -mime_type $mime -is_live t] attachments::attach -object_id $message_id -attachment_id $item_id # The posting form can be inside another transaction. Keep the draft # on rollback, and discard it only after the attachment is committed. ns_atclose [list ::forum::markdown_image::discard_attached_draft $message_id $uuid $path] }XQL Not present: Generic, PostgreSQL, Oracle