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

::xo::PackageMgr[i] ::xo::Package

Class Hierarchy of ::xo::Package

  • ::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
    • ::xo::db::Object[i]
      Methods for instances:
      db_1row, delete, initialize_loaded_object, insert, object_idC, object_titleC, save, save_new
      Methods to be applied on the class:
      Methods provided by the meta-class
      • ::xo::Package[i]
        Parameter for instances:
        context (default "::xo::cc"), force_refresh_login (default "false"), id, package_url, url
        Methods for instances:
        default_localeC, exists_form_parameterC, exists_query_parameterC, form_parameterC, get_parameter, init, initialize, insert, instance_nameC, package_idC, package_keyC, query_parameterC, reply_to_user, require_root_folder, return_page, returnredirectC, save, set_url
        Methods to be applied on the class:
        Methods provided by the meta-class

Class Relations

  • superclass: ::xo::db::Object[i]
  • subclass: ::xowiki::Package[i]
::xo::PackageMgr create ::xo::Package \
     -superclass ::xo::db::Object \
     -parameter {{context ::xo::cc} {force_refresh_login false} id package_url url}


  • instproc get_parameter

    ::2205471 instproc get_parameter {attribute {default {}}} {
        set param [::xo::parameter get  -parameter $attribute  -package_id [my id]  -default $default  -retry false]
        #my log "--get_parameter <$attribute> <$default> returned <$param>"
        return $param
  • instproc init

    ::2205471 instproc init args {
        my instvar id url
        set package_url [lindex [site_node::get_url_from_object_id -object_id $id] 0]
        #my log "--R creating package_url='$package_url'"
        if {$package_url ne ""} {
          array set info [site_node::get -url $package_url]
          #set package_url $info(url)
          my package_key $info(package_key)
          my instance_name $info(instance_name)
        } else {
          db_1row [my qn package_info] {
            select package_key, instance_name from apm_packages where package_id = :id
          my package_key $package_key
          my instance_name $instance_name
        if {[ns_conn isconnected]} {
          # in case of of host-node map, simplify the url to avoid redirects
          # .... but ad_host works only, when we are connected.... 
          # TODO: solution for syndication
          set root [root_of_host [ad_host]]
          regexp "^${root}(.*)$" $package_url _ package_url
        #my log "--R package_url= $package_url (was $info(url))"
        my package_url $package_url
        if {[my exists url] && [info exists root]} {
          regexp "^${root}(.*)$" $url _ url
        } elseif {![my exists url]} {
          #my log "--R we have no url, use package_url '$package_url'"
          # if we have no more information, we use the package_url as actual url
          set url $package_url
        my set_url -url $url
        my set mime_type text/html
        my set delivery ns_return
        set target_class ::[my package_key]::Package
        if {[my info class] ne $target_class && [my isclass $target_class]} {
          my class $target_class
        my initialize
  • instproc initialize

    ::2205471 instproc initialize {} { 
        # empty hook for user level initialization
  • instproc insert

    ::2205471 instproc insert {} {
          set __table_name [[self class] table_name]
          set __id [[self class] id_column]
          my set $__id [my set object_id]
          my log "ID insert in $__table_name, id = $__id = [my set $__id]"
          foreach {__slot_name __slot} [[self class] array get db_slot] {
    	my instvar $__slot_name
    	if {[info exists $__slot_name]} { 
    	  lappend __vars $__slot_name
    	  lappend __atts [$__slot column_name]
          db_dml dbqd..insert_$__table_name "insert into $__table_name
    	    ([join $__atts ,]) values (:[join $__vars ,:])"
  • instproc reply_to_user

    ::2205471 instproc reply_to_user text {
        #my log "REPLY [::xo::cc exists __continuation]"
        if {[::xo::cc exists __continuation]} {
          #my log "REPLY [::xo::cc set __continuation]"
          eval [::xo::cc set __continuation]
        } else {
          if {[string length $text] > 1} {
    	set status_code [expr {[::xo::cc exists status_code] ? [::xo::cc set status_code] : 200}]
            #my log "REPLY [my set delivery] 200 [my set mime_type]"
            [my set delivery] $status_code [my set mime_type] $text
  • instproc require_root_folder (public)

    <instance of ::xo::Package[i]> require_root_folder \
        [ -parent_id parent_id ] [ -content_types content_types ] \
        -name name 
    Make sure, the root folder for the given package exists. If not, create it and register all allowed content types.

    -parent_id (defaults to "-100") (optional)
    -content_types (optional)
    -name (required)
    ::2205471 instproc require_root_folder {{-parent_id -100} {-content_types {}} -name:required} {
        my instvar id
        set folder_id [ns_cache eval xotcl_object_type_cache root_folder-$id {
          set folder_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id]
          if {$folder_id == 0} {
            my log "folder with name '$name' and parent $parent_id does NOT EXIST"
            set folder_id [::xo::db::sql::content_folder new  -name $name -label $name  -parent_id $parent_id  -package_id $id -context_id $id]
            my log "CREATED folder '$name' and parent $parent_id ==> $folder_id"
          # register all specified content types
          ::xo::db::CrFolder register_content_types  -folder_id $folder_id  -content_types $content_types
          #my log "returning from cache folder_id $folder_id"
          return $folder_id
        #my log "returning from require folder_id $folder_id"
        return $folder_id
  • instproc return_page

    ::2205471 instproc return_page {-adp:required -variables -form} {
        #my log "--vars=[self args]"
        set __vars [list]
        foreach _var $variables {
          if {[llength $_var] == 2} {
            lappend __vars [lindex $_var 0] [uplevel subst [lindex $_var 1]]
          } else {
            set localvar local.$_var
            upvar $_var $localvar
            if {[array exists $localvar]} {
              lappend __vars &$_var $localvar
            } elseif {[info exists $localvar]} {
              # ignore undefined variables
              lappend __vars $_var [set $localvar]
        if {[info exists form]} {
          set level [template::adp_level]
          foreach f [uplevel #$level info vars ${form}:*] {
            lappend __vars &$f $f
            upvar #$level $f $f
        #my log "--before adp"   ; # $__vars
        set text [template::adp_include $adp $__vars]
        #my log "--after adp"
        if { [lang::util::translator_mode_p] } {
          set text [::xo::localize $text 1]
        #my log "--after adp"
        return $text
  • instproc save

    ::2205471 instproc save {} {
          db_transaction {
    	my instvar object_id package_key default_locale instance_name
    	db_dml dbqd..update_apm_packages {update apm_packages
    	  set package_key = :package_key,default_locale = :default_locale,instance_name = :instance_name where package_id = :object_id
  • instproc set_url

    ::2205471 instproc set_url -url {
        my url $url
        my set object [string range [my url] [string length [my package_url]] end]
        #my msg "--R object set to [my set object], url=$url, [my serialize]"


::xo::Package set __default_metaclass ::xotcl::Class
::xo::Package set __default_superclass ::xotcl::Object
::xo::Package set abstract_p f
::xo::Package set auto_save false
::xo::Package array set db_slot \
       {default_locale ::xo::Package::slot::default_locale package_key \
       ::xo::Package::slot::package_key package_id ::xo::Package::slot::package_id instance_name \
::xo::Package set id_column package_id
::xo::Package set name_method {}
::xo::Package set object_type apm_package
::xo::Package set object_type_key 73
::xo::Package set package_key apm_package
::xo::Package set pretty_name Package
::xo::Package set pretty_plural Package
::xo::Package set security_inherit_p t
::xo::Package set sql_package_name ::xo::Package
::xo::Package set supertype acs_object
::xo::Package set table_name apm_packages
::xo::Package set with_table true

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