- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::Link
::xowiki::Link create ... \
[ -form (default "") ] \
[ -is_self_link is_self_link ] \
[ -item_id item_id ] \
[ -lang lang ] \
[ -name name ] \
[ -package_id package_id ] \
[ -page page ] \
[ -parent_id parent_id ] \
[ -revision_id revision_id ] \
[ -stripped_name stripped_name ] \
[ -type (default "link") ]
Class Relations
- class: ::xotcl::Class
- superclass: ::xowiki::BaseLink
- subclass: ::xowiki::Link::language, ::xowiki::Link::glossary, ::xowiki::Link::image, ::xowiki::Link::folder
::xotcl::Class create ::xowiki::Link \ -superclass ::xowiki::BaseLinkMethods (to be applied on instances)
form (setter)
init (scripted)
#:log "--L link '${:name}' has item_id <[expr {[info exists :item_id] ? ${:item_id} : {none}}]>" set class [self class]::${:type} if {[:isclass $class]} {:class $class} if {![info exists :name]} { set :name [string trimleft ${:lang}:${:stripped_name} :] } elseif {![info exists :stripped_name]} { # set stripped name and lang from provided name or to the default if {![regexp {^(..):(.*)$} ${:name} _ lang :stripped_name]} { set :stripped_name ${:name} set :lang "" } } if {![info exists :label]} {set :label ${:name}} if {![info exists :parent_id]} {set :parent_id [${:page} parent_id]} if {![info exists :package_id]} {set :package_id [${:page} package_id]} #:log "--L link '${:name}' has class [:info class] // $class // ${:type} // parent ${:parent_id} // page ${:page} // [info exists :item_id]"is_self_link (setter)
item_id (setter)
lang (setter)
link_name (scripted)
return $lang:$stripped_namelookup_xowiki_package_by_name (scripted)
set ancestors [site_node::get_ancestors -node_id $start_package_id -element node_id] foreach a $ancestors { set package_id [site_node::get_children -node_id $a -package_key xowiki -filters [list name $name] -element package_id] if {$package_id ne ""} { #:log "--LINK found package_id=$package_id [nsf::is object ::$package_id]" ::xowiki::Package require $package_id return $package_id } } return 0name (setter)
new_link (scripted)
set nls_language [${:page} get_nls_language_from_lang ${:lang}] if {${:form} ne ""} { return [::${:package_id} make_form_link -form ${:form} -parent_id ${:parent_id} -name ${:name} -nls_language $nls_language] } if {[${:page} exists __unresolved_object_type]} { # # get the desired object_type for unresolved entries # set object_type [${:page} set __unresolved_object_type] } else { set object_type [[${:page} info class] set object_type] if {$object_type ne "::xowiki::Page" && $object_type ne "::xowiki::PlainPage"} { # # TODO: this is a temporary solution. We should find a way to # pass similar to file or image entries the type of this # entry. Maybe we can get the type as well from a kind of # blackboard, where the type of the "edit" wiki-menu-entry is # stored as well. # set object_type ::xowiki::Page } } return [${:page} new_link {*}[expr {[info exists object_type] ? [list -object_type $object_type] : {}}] -name ${:name} -title ${:label} -parent_id ${:parent_id} -nls_language $nls_language ${:package_id}]package_id (setter)
page (setter)
parent_id (setter)
pretty_link (scripted)
if {$item_id == 0} { set pageArg "" } else { set obj ::$item_id if {![nsf::is object $obj]} { set obj [::xo::db::CrClass get_instance_from_db -item_id $item_id] } set pageArg [list -page $obj] } return [::${:package_id} pretty_link -parent_id ${:parent_id} -lang ${:lang} -anchor ${:anchor} -query ${:query} {*}$pageArg ${:name}]render (scripted)
set item_id [:resolve] if {$item_id} { ${:page} references resolved [list $item_id ${:type}] ::xowiki::Package require ${:package_id} if {![info exists :href]} { set :href [:pretty_link $item_id] } :render_found ${:href} ${:label} } else { set new_link [:new_link] set html [:render_not_found $new_link ${:label}] ${:page} references unresolved [list parent_id ${:parent_id} name ${:name} link_type ${:type} html $html] return $html }render_found (scripted)
if {$href eq ""} { return "<span class='refused-link'>$label</span>" } elseif {[info exists :target] && ![:built_in_target]} { return [:render_target $href $label] } else { return "<a [:anchor_atts] [:mk_css_class_and_id] href='[ns_quotehtml $href]'>$label</a>" }render_not_found (scripted)
if {$href eq ""} { return \[$label\] } else { return "<a [:mk_css_class_and_id -additional missing] href='[ns_quotehtml $href]'>$label</a>" }render_target (scripted)
#ns_log notice render_target if {[info commands ::xowiki::template::${:target}] ne ""} { # # The target template exists. Use the template # # This is a situation, where potentially a # recursive inclusion is happening. The included content is # added to the html output only once, with a unique id, which # can be referenced multiple times. The link is included for # each occurrence. # set targetId [xowiki::Includelet html_id ${:item_id}-${:target}] set page [::xo::db::CrClass get_instance_from_db -item_id ${:item_id} -revision_id 0] set content "Loading ..." set withBody true if {[::xowiki::template::${:target} render_content]} { set key ::__xowiki_link_rendered($targetId) if {![info exists $key]} { set $key 1 set content [$page render_content] } else { #ns_log notice "modal with is already included: $key" set page ::${:item_id} set withBody false } } set result [::xowiki::template::${:target} render -with_body $withBody -title [$page title] -id $targetId -content $content -label $label -href $href] return $result } else { ns_log notice "xowiki::link: unknown target ${:target}" return "<a [:anchor_atts] [:mk_css_class_and_id] href='[ns_quotehtml $href]'>$label</a>" }resolve (scripted)
return ${:item_id}revision_id (setter)
stripped_name (setter)
type (setter)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables