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

::xotcl::Class[i] ::xo::PackageMgr

Class Hierarchy of ::xo::PackageMgr

  • ::xotcl::Object[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
    • ::xotcl::Class[i]
      Parameter for instances:
      __default_metaclass (default "::xotcl::Class"), __default_superclass (default "::xotcl::Object")
      Methods for instances:
      ad_instproc, allinstances, allocC, createC, deallocC, extend_slot, infoC, instfilterC, instfilterguardC, instforward, instinvarC, instmixinC, instmixinguardC, instparametercmdC, instproc, method, newC, parameter, recreateC, slots, superclassC, unknown, uses
      Methods to be applied on the class (in addition to the methods provided by the meta-class):

Class Relations

  • superclass: ::xo::db::Class[i]
::xotcl::Class create ::xo::PackageMgr \
     -superclass ::xo::db::Class \
     -parameter package_key


  • proc get_package_class_from_package_key (public)

    ::xo::PackageMgr[i] get_package_class_from_package_key package_key
    Obtain the package class from a package key

    ::310658 proc get_package_class_from_package_key package_key {
        foreach p [::xo::PackageMgr allinstances] {
          # Sanity check for old apps, having not set the package key.
          # TODO: remove this in future versions, when package_keys are enforced
          if {![$p exists package_key]} {
            ns_log notice "!!! You should provide a package_key for $p [$p info class] !!!"
          if {[$p package_key] eq $package_key} {
            return $p
        return ""
  • instproc first_instance (public)

    <instance of ::xo::PackageMgr[i]> first_instance \
        [ -privilege privilege ] [ -party_id party_id ]

    -privilege (optional)
    -party_id (optional)
    return first mounted instance of this type
    ::310658 instproc first_instance {-privilege -party_id} {
        my instvar package_key
        if {[info exists privilege]} {
          set sql [::xo::db::sql select -vars package_id  -from "apm_packages, acs_object_party_privilege_map ppm, site_nodes s"  -where {
                         package_key = :package_key 
                         and s.object_id = package_id 
                         and ppm.object_id = package_id 
                         and ppm.party_id = :party_id
                         and ppm.privilege = :privilege
                       } -limit 1]
          db_string [my qn get_package_id] $sql
        } else {
          ::xo::parameter get_package_id_from_package_key -package_key $package_key
  • instproc initialize (public)

    <instance of ::xo::PackageMgr[i]> initialize [ -ad_doc ad_doc ] \
        [ -parameter parameter ] [ -package_id package_id ] [ -url url ] \
        [ -user_id user_id ] [ -actual_query actual_query ] \
        [ -original_url_and_query original_url_and_query ] \
        [ -init_url init_url ] [ -keep_cc keep_cc ] \
        [ -form_parameter form_parameter ] [ -export_vars export_vars ]
    Create the connection context ::xo::cc and a package object if these are none defined yet. The connection context ::xo::cc and the package object will be destroyed on cleanup, when the global variables are reclaimed. As a side effect this method sets in the calling context the query parameters and package_id as variables, using the "defaults" for default values. init_url false requires the package_id to be specified and a call to Package instproc set_url to complete initialization. keep_cc true means that the original connection context is preserved (i.e. not altered) in case it exists already.

    -ad_doc (optional)
    -parameter (optional)
    -package_id (defaults to "0") (optional)
    -url (optional)
    -user_id (defaults to "-1") (optional)
    -actual_query (defaults to " ") (optional)
    -original_url_and_query (optional)
    -init_url (defaults to "true") (optional)
    -keep_cc (defaults to "false") (optional)
    -form_parameter (optional)
    -export_vars (defaults to "true") (optional)
    ::310658 instproc initialize {-ad_doc {-parameter ""} {-package_id 0} {-url ""} {-user_id -1} {-actual_query " "} -original_url_and_query {-init_url true} {-keep_cc false} -form_parameter {-export_vars true}} {
        #my msg "--i [self args], URL=$url, init_url=$init_url"
        if {$url eq "" && $init_url} {
          set url [root_of_host [ad_host]][ns_conn url]
          #my log "--CONN ns_conn url -> $url"
        # get package_id from url in case it is not known
        set package_id [ConnectionContext require_package_id_from_url  -package_id $package_id $url]
        # require connection context if needed
        ConnectionContext require  -keep_cc $keep_cc  -package_id $package_id -user_id $user_id  -parameter $parameter -url $url -actual_query $actual_query
        if {[info exists original_url_and_query]} {
          ::xo::cc original_url_and_query $original_url_and_query
        if {[info exists form_parameter]} {
          ::xo::cc array set form_parameter $form_parameter
        # create package object if necessary
        if {$keep_cc} {
          my require $package_id
        } else {
          my require -url $url $package_id
        # In case the login expired, we can force an early login to
        # prevent later login redirects, which can cause problems
        # from within catch operations. The package can decide, if
        # it want to force a refresh of the login, even if some pages 
        # might not require the real user_id.
        #my msg "force [$package_id force_refresh_login] && #	[::xo::cc set untrusted_user_id] != [::xo::cc user_id]"
        if {[$package_id force_refresh_login] && 
    	[::xo::cc set untrusted_user_id] != [::xo::cc user_id]} {
        if {$export_vars} {::xo::cc export_vars -level 2}
        return $package_id
  • instproc instances (public)

    <instance of ::xo::PackageMgr[i]> instances \
        [ -include_unmounted include_unmounted ] [ -closure closure ]

    -include_unmounted (defaults to "false") (optional)
    include unmounted package instances
    -closure (defaults to "false") (optional)
    include instances of subclasses of the package
    list of package_ids of xowiki instances
    ::310658 instproc instances {{-include_unmounted false} {-closure false}} {
        my instvar package_key
        if {$include_unmounted} {
          set result [db_list [my qn get_xowiki_packages] {select package_id  from apm_packages where package_key = :package_key}]
        } else {
          set result [db_list [my qn get_mounted_packages] {select package_id  from apm_packages p, site_nodes s   where package_key = :package_key and s.object_id = p.package_id}]
        if {$closure} {
          foreach subclass [my info subclass] {
    	foreach id [$subclass instances -include_unmounted $include_unmounted -closure true] {
    	  lappend result $id
        return [lsort -integer $result]
  • instproc require (public)

    <instance of ::xo::PackageMgr[i]> require [ -url url ] package_id
    Create package object if needed.

    -url (optional)
    ::310658 instproc require {{-url ""} package_id} {
        if {$package_id eq ""} {error "package_id must not be empty"}
        #my log "--R $package_id exists? [my isobject ::$package_id] url='$url'"
        if {![my isobject ::$package_id]} {
          #my log "--R we have to create ::$package_id //url='$url'"
          # To make initialization code generic, we obtain from the
          # package_id the class of the package.
          set package_key [apm_package_key_from_id $package_id]
          set package_class [[self class] get_package_class_from_package_key $package_key]
          if {$package_class eq ""} {
            # For some unknown reason, we did not find the key.  We want
            # to be conservative, behave like in older versions that did
            # not provide a package_key, but required for this call to be
            # invoked on the actual class of the package. We provide
            # compatibility, but complain in ns_log. 
            # (E.g. hypermail2xowiki uses this)
            ns_log notice "Could not find ::xo::Package with key $package_key ($package_id)"
            set package_class [self]
          if {$url ne ""} {
            $package_class create ::$package_id -destroy_on_cleanup -id $package_id -url $url
          } else {
            $package_class create ::$package_id -destroy_on_cleanup -id $package_id
        } else {
          if {$url ne ""} {
            ::$package_id set_url -url $url


::s5::Package[i], ::xo::Package[i], ::xowf::Package[i], ::xowiki::Package[i]

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