item::get_extended_url (public, deprecated)

 item::get_extended_url item_id [ args... ]

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

Deprecated. Invoking this procedure generates a warning.

Retrieves the relative URL of the item with a file extension based on the item's mime_type (Example: "/foo/bar/baz.html").

Parameters:
item_id (required)
The item id
Options:
-template_extension
Signifies that the file extension should be retrieved using the mime_type of the template assigned to the item, not from the item itself. The live revision of the template is used. If there is no template which could be used to render the item, or if the template has no live revision, the extension defaults to ".html"
-revision_id
{default the live revision} Specifies the revision_id which will be used to retrieve the item's mime_type. This option is ignored if the -template_extension option is specified.
Returns:
The relative URL of the item with the appropriate file extension or an empty string on failure
See Also:
  • proc item::get_url
  • proc item::get_mime_info
  • proc item::get_template_id

Testcases:
No testcase defined.
Source code:
ad_log_deprecated proc item::get_extended_url

  set item_url [get_url $item_id]

  if { [template::util::is_nil item_url] } {
    ns_log warning "item::get_extended_url: No item URL found for content item $item_id"
    return ""
  }

  template::util::get_opts $args

  # Get full path
  set file_url [ns_normalizepath "/$item_url"]

  # Determine file extension
  if { [info exists opts(template_extension)] } {

    set file_extension "html"

    # Use template mime type
    set template_id [get_template_id $item_id]

    if { ![template::util::is_nil template_id] } {
      # Get extension from the template mime type
      set template_revision_id [::content::item::get_best_revision -item_id $template_id]

      if { ![template::util::is_nil template_revision_id] } {
        get_mime_info $template_revision_id mime_info

        if { [info exists mime_info(file_extension)] } {
          set file_extension $mime_info(file_extension)
        }
      }

    }
  } else {
    # Use item mime type if template extension does not exist

    # Determine live revision, if none specified
    if { ![info exists opts(revision_id)] } {
      set revision_id [::content::item::get_live_revision -item_id $item_id]

      if { [template::util::is_nil revision_id] } {
        ns_log warning "item::get_best_revision: No live revision for content item $item_id"
        return ""
      }

    } else {
      set revision_id $opts(revision_id)
    }

    get_mime_info $revision_id mime_info
    if { [info exists mime_info(file_extension)] } {
        set file_extension $mime_info(file_extension)
    } else {
        set file_extension "html"
    }
  }

  append file_url ".$file_extension"

  return $file_url
Generic XQL file:
packages/acs-content-repository/tcl/deprecated-procs.xql

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

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

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