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):
packages/forums/lib/message/edit.tcl packages/forums/ lib/message/edit.tcl forum::markdown_image::drafts forum::markdown_image::drafts packages/forums/lib/message/edit.tcl->forum::markdown_image::drafts packages/forums/lib/message/post.tcl packages/forums/ lib/message/post.tcl packages/forums/lib/message/post.tcl->forum::markdown_image::drafts ad_conn ad_conn (public) forum::markdown_image::drafts->ad_conn forum::image_paste_enabled_p forum::image_paste_enabled_p (public) forum::markdown_image::drafts->forum::image_paste_enabled_p forum::markdown_image::attachment forum::markdown_image::attachment (private) forum::markdown_image::drafts->forum::markdown_image::attachment forum::markdown_image::draft_path forum::markdown_image::draft_path (private) forum::markdown_image::drafts->forum::markdown_image::draft_path forum::markdown_image::mime_type forum::markdown_image::mime_type (private) forum::markdown_image::drafts->forum::markdown_image::mime_type

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 $drafts
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: