xowiki::markdown_image::attach (private)

 xowiki::markdown_image::attach page drafts

Defined in packages/xowiki/tcl/markdown-image-procs.tcl

Save each staged image as an attachment owned by this page.

Parameters:
page (required)
drafts (required)

Partial Call Graph (max 5 caller/called nodes):
xowiki::Page instproc save_new xowiki::Page instproc save_new (public) xowiki::markdown_image::attach xowiki::markdown_image::attach xowiki::Page instproc save_new->xowiki::markdown_image::attach ad_conn ad_conn (public) xowiki::markdown_image::attach->ad_conn attachments::richtext::file_attach attachments::richtext::file_attach (public) xowiki::markdown_image::attach->attachments::richtext::file_attach

Testcases:
No testcase defined.
Source code:
  set object_id [$page item_id]
  dict for {image_id draft} $drafts {
    lassign $draft path mime
    set result [attachments::richtext::file_attach  -item_id $image_id -object_id $object_id  -import_file $path -mime_type $mime  -title "Pasted image.[lindex [split $mime /] 1]"  -user_id [ad_conn user_id] -peeraddr [ad_conn peeraddr]  -package_id [$page package_id]]
    if {![dict get $result success]} {
      error "Could not attach the pasted image."
    }
    # FormPage may still be inside an outer transaction. Verify the commit
    # before discarding the file, so the editor can retry a failed save.
    ns_atclose [list ::xowiki::markdown_image::discard_attached_draft $object_id $image_id $path]
  }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: