fs::add_created_file (public, deprecated)

 fs::add_created_file [ -name name ] -parent_id parent_id \
    -package_id package_id [ -item_id item_id ] \
    [ -mime_type mime_type ] [ -creation_user creation_user ] \
    [ -creation_ip creation_ip ] [ -title title ] \
    [ -description description ] [ -content_body content_body ]

Defined in packages/file-storage/tcl/file-storage-procs.tcl

Deprecated. Invoking this procedure generates a warning.

Create a new file storage item or add a new revision if an item with the same name and parent folder already exists DEPRECATED: this proc was superseded by fs::add_file

Switches:
-name (optional)
-parent_id (required)
-package_id (required)
-item_id (optional)
-mime_type (optional)
-creation_user (optional)
-creation_ip (optional)
-title (optional)
-description (optional)
-content_body (optional)
Returns:
revision_id
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 ad_conn ad_conn (public) ad_log_deprecated ad_log_deprecated (public) callback callback (public) db_exec_plsql db_exec_plsql (public) db_string db_string (public) fs::add_created_file fs::add_created_file fs::add_created_file->ad_conn fs::add_created_file->ad_log_deprecated fs::add_created_file->callback fs::add_created_file->db_exec_plsql fs::add_created_file->db_string

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc fs::add_created_file
    if {[parameter::get -parameter "StoreFilesInDatabaseP" -package_id $package_id]} {
        set indbp "t"
        set storage_type "lob"
    } else {
        set indbp "f"
        set storage_type "file"
    }
    if {$item_id ne ""} {
        set storage_type [db_string get_storage_type {
            select storage_type from cr_items where item_id=:item_id
        }]
    }
    if {$mime_type eq "" } {
        set mime_type "text/html"
    }
    if { $name eq "" } {
        set name $title
    }

    set content_type "file_storage_object"

    db_transaction {
        if {$item_id eq "" || ![db_string item_exists {}]} {
            set item_id [db_exec_plsql create_item ""]
            if {$creation_user ne ""} {
                permission::grant -party_id $creation_user -object_id $item_id -privilege admin
            }
            set do_notify_here_p "t"
        } else {
            set do_notify_here_p "f"
        }

        set revision_id [fs::add_created_version  -name $title  -item_id $item_id  -creation_user $creation_user  -creation_ip [ad_conn peeradd]  -title $title  -description $description  -package_id $package_id  -content_body $content_body  -mime_type $mime_type  -storage_type $storage_type]


        if {[string is true $do_notify_here_p]} {
            fs::do_notifications  -folder_id $parent_id  -filename $title  -item_id $revision_id  -action "new_file"  -package_id $package_id
        }

        if {!$no_callback_p} {
            callback fs::file_new  -package_id [ad_conn package_id]  -file_id $item_id
        }
    }
    return $revision_id
Generic XQL file:
<fullquery name="fs::add_created_file.item_exists">
    <querytext>
          select count(*) from cr_items
          where name=:name
          and parent_id=:parent_id
   </querytext>
</fullquery>
packages/file-storage/tcl/file-storage-procs.xql

PostgreSQL XQL file:
<fullquery name="fs::add_created_file.create_item">
    <querytext>
      select file_storage__new_file (
          :name,
          :parent_id,
	  :creation_user,
          :creation_ip,
          :indbp,
          :item_id,
          :package_id
      )
    </querytext>
</fullquery>
packages/file-storage/tcl/file-storage-procs-postgresql.xql

Oracle XQL file:
packages/file-storage/tcl/file-storage-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: