attachments::richtext::file_attach (public)

 attachments::richtext::file_attach [ -import_file import_file ] \
    [ -title title ] [ -mime_type mime_type ] [ -object_id object_id ] \
    [ -item_id item_id ] [ -privilege privilege ] [ -user_id user_id ] \
    [ -peeraddr peeraddr ] [ -package_id package_id ]

Defined in packages/attachments/tcl/richtext-procs.tcl

Insert the provided file to the content repository as a new item and attach it to the specified object_id via the attachment API. This makes sure that the file will be deleted from the content repository, when the provided object_id is deleted.

Switches:
-import_file (optional)
-title (optional)
-mime_type (optional)
-object_id (optional)
-item_id (optional)
optional preallocated content item ID The user must have at least "read" privileges on the object, but other stronger privileges can be supplied via parameter.
-privilege (optional, defaults to "read")
-user_id (optional)
-peeraddr (optional)
-package_id (optional)

Partial Call Graph (max 5 caller/called nodes):
news::markdown_image::attach news::markdown_image::attach (private) attachments::richtext::file_attach attachments::richtext::file_attach news::markdown_image::attach->attachments::richtext::file_attach packages/attachments/www/richtext/file-browser.tcl packages/attachments/ www/richtext/file-browser.tcl packages/attachments/www/richtext/file-browser.tcl->attachments::richtext::file_attach attachments::attach attachments::attach (public) attachments::richtext::file_attach->attachments::attach attachments::richtext::require_root_folder attachments::richtext::require_root_folder (private) attachments::richtext::file_attach->attachments::richtext::require_root_folder content::item::new content::item::new (public) attachments::richtext::file_attach->content::item::new permission::require_permission permission::require_permission (public) attachments::richtext::file_attach->permission::require_permission

Testcases:
No testcase defined.
Source code:
        permission::require_permission  -party_id $user_id  -object_id $object_id  -privilege $privilege

        set success 1

        #
        # Create a new item
        #
        set name $object_id-[clock clicks -microseconds]
        if {![info exists title]} {
            set title $name
        }
       set item_id [::content::item::new  -name            $name  -item_id         $item_id  -parent_id       [require_root_folder]  -title           $title  -context_id      $object_id  -creation_user   $user_id  -creation_ip     $peeraddr  -storage_type    "file"  -package_id      $package_id  -tmp_filename    $import_file  -mime_type       $mime_type  -is_live         t]

        #
        # Attach the file to the object via the attachments API
        #
        attachments::attach  -object_id $object_id  -attachment_id $item_id

        return [list  success $success  name $name  item_id $item_id
                   ]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: