xowiki::Package instproc item_info_from_url

 <instance of xowiki::Package[i]> item_info_from_url

Defined in

Partial Call Graph (max 5 caller/called nodes):
%3 test_path_resolve path_resolve (test ) xowiki::Package instproc item_info_from_url xowiki::Package instproc item_info_from_url test_path_resolve->xowiki::Package instproc item_info_from_url test_xowiki xowiki (test ) test_xowiki->xowiki::Package instproc item_info_from_url

Testcases:
path_resolve, xowiki
Source code:
#
# Obtain item info (item_id parent_id lang stripped_name) from the
# specified url. Search starts always at the root.
#
# @param with_package_prefix flag, if provided URL contains package-url
# @return item ref data (parent_id lang stripped_name method)
#
if {$with_package_prefix && [string match "/*" $url]} {
  set url [string range $url [string length [:package_url]] end]
}
if {$default_lang eq ""} {set default_lang [:default_language]}
:get_lang_and_name -default_lang $default_lang -path $url (lang) stripped_url
#:log "get_lang_and_name -default_lang $default_lang -path $url -> $(lang) '$stripped_url'"

set (parent_id) [:get_parent_and_name  -lang $(lang) -path $stripped_url  -parent_id ${:folder_id}  parent local_name]
#:log "get_parent_and_name '$stripped_url' returns [array get {}]"

if {![regexp {^(download)/(.+)$} $(lang) _ (method) (lang)]} {
  set (method) ""
  # The lang value "tag" is used for allowing tag-URLs without
  # parameters, since several tag harvester assume such a syntax
  # and don't process arguments. We rewrite in such cases simply
  # the url and query parameters and update the connection
  # context.
  if {$(lang) eq "tag"} {
    # todo: missing: tag links to subdirectories, also on url generation
    set tag $stripped_url
    :validate_tag $tag
    set summary [string is true -strict [::xo::cc query_parameter summary:boolean 0]]
    set popular [string is true -strict [::xo::cc query_parameter popular:boolean 0]]
    set tag_kind [expr {$popular ? "ptag" :"tag"}]
    set weblog_page [:get_parameter -check_query_parameter false weblog_page:graph]
    :get_lang_and_name -default_lang $default_lang -name $weblog_page (lang) local_name
    set :object $weblog_page
    ::xo::cc set actual_query $tag_kind=$tag&summary=$summary
  }
}
array set "" [:prefixed_lookup -parent_id $(parent_id)  -default_lang $default_lang -lang $(lang)  -stripped_name $local_name]
#:log "prefixed_lookup '$local_name' returns [array get {}]"

if {$(item_id) == 0} {
  #
  # Check symlink (todo: should this happen in package->lookup?)
  #
  ::xo::db::CrClass get_instance_from_db -item_id $(parent_id)
  if {[$(parent_id) is_link_page]} {
    #
    #  We encompassed a link to a page or folder, treat both the same way.
    #
    #:log "item_info_from_url LINK page $(parent_id)"

    set link_id $(parent_id)
    set target [::$link_id get_target_from_link_page]

    $target set_resolve_context -package_id ${:id} -parent_id $link_id
    array set "" [list logical_package_id ${:id} logical_parent_id $link_id]

    #:log "SYMLINK PREFIXED $target ([$target name]) set_resolve_context -package_id ${:id} -parent_id $link_id"

    array set "" [[$target package_id] prefixed_lookup -parent_id [$target item_id]  -default_lang $default_lang -lang $(lang) -stripped_name $(stripped_name)]
    #
    # We can't reset the resolve context here, since it is also
    # required for rendering the target
    #
  }
}
#:log "final returns [array get {}]"

return [array get ""]
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: