publish::handle_binary_file (public)

 publish::handle_binary_file item_id revision_id_ref url_ref error_ref \
    [ args... ]

Defined in packages/acs-content-repository/tcl/publish-procs.tcl

Parameters:
item_id (required)
The id of the item to handle
revision_id_ref (required)
{required} The name of the variable in the calling frame that will receive the revision_id whose content blob was written to the filesystem.
url_ref (required)
The name of the variable in the calling frame that will receive the relative URL of the file in the filesystem which contains the content blob
error_ref (required)
The name of the variable in the calling frame that will receive an error message. If no error has occurred, this variable will be set to the empty string ""
Options:
-embed
Signifies that the content should be embedded directly in the parent item. -embed is required for this proc, since it makes no sense to handle the binary file in any other way.
-revision_id
{default The live revision for the item} The revision whose content is to be used
-no_merge
If present, do NOT merge with the template, in order to prevent infinite recursion in the <content> tag. In this case, the proc will return the empty string ""
Returns:
The HTML resulting from merging the item with its template, or "" if no template exists or the -no_merge flag was specified
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 publish::handle::image publish::handle::image (public) publish::handle_binary_file publish::handle_binary_file publish::handle::image->publish::handle_binary_file content::item::get_live_revision content::item::get_live_revision (public) publish::handle_binary_file->content::item::get_live_revision publish::get_publish_roots publish::get_publish_roots (public) publish::handle_binary_file->publish::get_publish_roots publish::merge_with_template publish::merge_with_template (private) publish::handle_binary_file->publish::merge_with_template publish::write_content publish::write_content (public) publish::handle_binary_file->publish::write_content template::util::get_opts template::util::get_opts (public) publish::handle_binary_file->template::util::get_opts

Testcases:
No testcase defined.
Source code:

  template::util::get_opts $args

  upvar $error_ref error_msg
  upvar $url_ref file_url
  upvar $revision_id_ref revision_id
  set error_msg ""

  if { ![info exists opts(revision_id)] } {
    set revision_id [::content::item::get_live_revision -item_id $item_id]
  } else {
    set revision_id $opts(revision_id)
  }

  # If the embed tag is true, return the html. Otherwise,
  # just write the image to the filesystem
  if { [info exists opts(embed)] } {

    set file_url [publish::write_content $revision_id  -item_id $item_id -root_path [publish::get_publish_roots]]

    # If write_content aborted, give up
    if { [template::util::is_nil file_url] } {
      set error_msg "No URL found for revision $revision_id, item $item_id"
      return ""
    }

    # Try to use the registered template for the image
    if { ![info exists opts(no_merge)] } {
      set html [publish::merge_with_template $item_id {*}$args]
      # Return the result of merging - could be ""
      return $html
    }

    return ""

  } else {
    set error_msg "No embed specified for handle_binary_file, aborting"
    return ""
  }
Generic XQL file:
packages/acs-content-repository/tcl/publish-procs.xql

PostgreSQL XQL file:
packages/acs-content-repository/tcl/publish-procs-postgresql.xql

Oracle XQL file:
packages/acs-content-repository/tcl/publish-procs-oracle.xql

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