xotcl.wu-wien.ac.at
Begin main content
Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]

::xotcl::Class[i] ::xowiki::Link

Class Hierarchy of ::xowiki::Link

  • ::xotcl::Object[i]
    Meta-class:
    ::xotcl::Class[i]
    Methods for instances:
    __api_make_doc, __api_make_forward_doc, __timediff, abstract, ad_doc, ad_forward, ad_proc, appendC, arrayC, asHTML, autonameC, check, classC, cleanupC, configureC, containsC, copyC, db_0or1rowC, db_1rowC, debug, defaultmethodC, destroyC, destroy_on_cleanup, ds, evalC, existsC, extractConfigureArg, filterC, filterguardC, filtersearch, forward, hasclass, incrC, infoC, init, instvarC, invarC, isclass, ismetaclass, ismixin, isobject, istype, lappendC, log, method, mixinC, mixinguardC, moveC, msg, noinitC, objectparameter, parametercmdC, proc, procsearch, qn, requireNamespaceC, residualargsC, self, serialize, setC, set_instance_vars_defaults, show-object, substC, traceC, unknown, unsetC, uplevelC, upvarC, volatileC, vwait
    Methods to be applied on the class (in addition to the methods provided by the meta-class):
    getExitHandler, setExitHandler, unsetExitHandler
    • ::xowiki::BaseLink[i]
      Meta-class:
      ::xotcl::Class[i]
      Parameter for instances:
      anchor (default ""), cssclass, cssid, extra_query_parameter, href, label, query (default ""), target, title
      Methods for instances:
      mk_css_class, mk_css_class_and_id
      Methods to be applied on the class:
      Methods provided by the meta-class
      • ::xowiki::Link[i]
        Meta-class:
        ::xotcl::Class[i]
        Parameter for instances:
        form (default ""), item_id, lang, name, package_id, page, parent_id, revision_id, stripped_name, type (default "link")
        Methods for instances:
        atts, init, link_name, lookup_xowiki_package_by_name, new_link, pretty_link, render, render_found, render_not_found, resolve
        Methods to be applied on the class:
        Methods provided by the meta-class

Class Relations

  • superclass: ::xowiki::BaseLink[i]
  • subclass: ::xowiki::Link::folder[i], ::xowiki::Link::glossary[i], ::xowiki::Link::image[i], ::xowiki::Link::language[i]
::xotcl::Class create ::xowiki::Link \
     -superclass ::xowiki::BaseLink \
     -parameter {{form ""} item_id lang name package_id page parent_id revision_id stripped_name \
       {type link}}

Methods

  • instproc atts

    ::241221 instproc atts {} {
        set atts ""
        if {[my exists title]}  {append atts " title='[string map [list ' {'}] [my title]]'"}
        if {[my exists target]} {append atts " target='[my target]'"}
      }
    
  • instproc init

    ::241221 instproc init {} {
        my instvar page name
        set class [self class]::[my type]
        if {[my isclass $class]} {my class $class}
        if {![my exists name]} {
          set name [string trimleft [my lang]:[my stripped_name] :]
        } elseif {![my exists stripped_name]} {
          # set stripped name and lang from provided name or to the default
          my instvar stripped_name lang
          if {![regexp {^(..):(.*)$} $name _ lang stripped_name]} {
            set stripped_name $name; set lang ""
          }
        }
        if {![my exists label]}      {my label $name}
        if {![my exists parent_id]}  {my parent_id [$page parent_id]}
        if {![my exists package_id]} {my package_id [$page package_id]}
        #my msg "--L link has class [my info class] // $class // [my type] // [my parent_id]"
      }
    
  • instproc link_name

    ::241221 instproc link_name {-lang -stripped_name} {
        return $lang:$stripped_name
      }
    
  • instproc lookup_xowiki_package_by_name

    ::241221 instproc lookup_xowiki_package_by_name {name start_package_id} {
        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 ""} {
            #my log "--LINK found package_id=$package_id [my isobject ::$package_id]"
            ::xowiki::Package require $package_id
            return $package_id
          }
        }
        return 0
      }
    
  • instproc new_link

    ::241221 instproc new_link {} {
        my instvar package_id form
        set page [my page]
        set nls_language [$page get_nls_language_from_lang [my lang]]
        if {$form ne ""} {
          return [$package_id make_form_link -form $form  -parent_id [my parent_id]  -name [my name]  -nls_language $nls_language]
        }
        if {[$page exists __unresolved_object_type]} {
          # get the desired object_type for unresoved 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 -name [my name] -title [my label] -parent_id [my parent_id]  -nls_language $nls_language $package_id]
      }
    
  • instproc pretty_link

    ::241221 instproc pretty_link item_id {
        my instvar package_id
        return [::$package_id pretty_link -parent_id [my parent_id] -lang [my lang]  -anchor [my anchor] -query [my query] [my name]]
      }
    
  • instproc render

    ::241221 instproc render {} {
        my instvar package_id
        set page [my page]
        set item_id [my resolve]
        if {$item_id} {
          $page lappend references [list $item_id [my type]]
          ::xowiki::Package require $package_id
          my render_found [my pretty_link $item_id] [my label]
        } else {
          $page incr unresolved_references
          set new_link [my new_link]
          set html [my render_not_found $new_link [my label]]
          $page lappend __unresolved_references $html
          return $html
        }
      }
    
  • instproc render_found

    ::241221 instproc render_found {href label} {
        return "<a [my atts] [my mk_css_class_and_id] href='$href'>$label</a>"
      }
    
  • instproc render_not_found

    ::241221 instproc render_not_found {href label} {
        if {$href eq ""} {
          return \[$label\]
        } else {
          return "<a [my mk_css_class_and_id -additional missing] href='$href'> $label</a>"
        }
      }
    
  • instproc resolve

    ::241221 instproc resolve {} {
        return [my item_id]
      }
    

Methods: Source: Variables:
[All Methods | Documented Methods | Hide Methods] [Display Source | Hide Source] [Show Variables | Hide Variables]