forum::markdown_image::drafts (private)
forum::markdown_image::drafts forum_id message_id content format
Defined in packages/forums/tcl/markdown-image-procs.tcl
Find this message's pasted images that still need to be attached.
- Parameters:
- forum_id (required)
- message_id (required)
- content (required)
- format (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: if {$format ne "text/html" || [string first markdown-image?key= $content] == -1} { return {} } set prefix [ad_conn package_url]markdown-image?key= set drafts {} foreach tag [ns_parsehtml -onlytags -- $content] { lassign $tag element attributes if {![string equal -nocase $element img] || ![dict exists $attributes src]} { continue } set src [dict get $attributes src] if {[string first $prefix $src] != 0} { continue } # Responsive delivery adds query parameters after the stable image identity. set key [lindex [split [string range $src [string length $prefix] end] &] 0] lassign [parts $key] image_forum image_message uuid if {$forum_id ne $image_forum || $message_id ne $image_message || [dict exists $drafts $uuid] || [attachment $message_id $uuid] ne ""} { continue } set path [draft_path $key] set mime [mime_type $path] if {$mime eq "" || ![forum::image_paste_enabled_p -forum_id $forum_id]} { return -code error -errorcode {FORUM IMAGE UNAVAILABLE} "A pasted image is unavailable. Remove it or paste it again." } dict set drafts $uuid [list $path $mime] } return $draftsXQL Not present: Generic, PostgreSQL, Oracle