Class ::xo::Package (public)
::xo::PackageMgr ::xo::Package
Defined in
- Testcases:
-
No testcase defined.
Source code:
namespace eval ::xo {}
::nsf::object::alloc ::xo::PackageMgr ::xo::Package {set :__default_metaclass ::xotcl::Class
set :__default_superclass ::xotcl::Object
set :abstract_p f
set :auto_save false
array set :db_constraints {}
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::slot::instance_name}
set :default_package_parameter_page_info {}
set :default_package_parameters {}
set :id_column package_id
set :name_method {}
set :object_type apm_package
set :object_type_key 0000000000000101
set :package_key apm_package
set :pretty_name Package
set :pretty_plural Package
set :security_inherit_p t
set :site_wide_package_parameter_page_info {}
set :site_wide_package_parameters {}
set :site_wide_pages {}
set :sql_package_name ::xo::Package
set :supertype acs_object
set :table_name apm_packages
set :with_table true}
::xo::Package instproc get_parameter {attribute {default {}}} {
set value [::parameter::get -package_id ${:id} -parameter $attribute -default $default]
if {$value ne $default} {
return $value
}
return [parameter::get_global_value -package_key ${:package_key} -parameter $attribute -default $default]
}
::xo::Package instproc process_init_parameter init_parameter {
}
::xo::Package instproc require_root_folder {{-parent_id -100} {-content_types {}} -name:required} {
set folder_id [::xo::xotcl_package_cache eval root_folder-${:id} {
set folder_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id]
if {$folder_id == 0} {
:log "folder with name '$name' and parent $parent_id does NOT EXIST"
set folder_id [::acs::dc call content_folder new -name $name -label ${:instance_name} -parent_id $parent_id -package_id ${:id} -context_id ${:id}]
:log "CREATED folder '$name' and parent $parent_id ==> $folder_id"
}
::xo::db::CrFolder register_content_types -folder_id $folder_id -content_types $content_types
return $folder_id
}]
return $folder_id
}
::xo::Package instproc return_page {-adp:required -variables -form} {
set __vars [list]
foreach _var $variables {
if {[llength $_var] == 2} {
lappend __vars [lindex $_var 0] [uplevel [list subst [lindex $_var 1]]]
} else {
set localvar local.$_var
upvar $_var $localvar
if {[array exists $localvar]} {
lappend __vars &$_var $localvar
} elseif {[info exists $localvar]} {
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
}
}
set adp [template::themed_template $adp]
set text [template::adp_include $adp $__vars]
if { [lang::util::translator_mode_p] } {
set text [::xo::localize $text 1]
}
return [::xo::remove_escapes $text]
}
::xo::Package instproc reply_to_user text {
:handle_http_caching
if {[::xo::cc exists __continuation]} {
eval [::xo::cc set __continuation]
} else {
if {[string length $text] > 1} {
set default_status_code 200
} else {
set default_status_code 204
}
set status_code [expr {[::xo::cc exists status_code]
? [::xo::cc set status_code]
: $default_status_code}]
${:delivery} $status_code ${:mime_type} $text
}
}
::xo::Package instproc init args {
set id ${:id}
set package_url [lindex [site_node::get_url_from_object_id -object_id $id] 0]
if {$package_url ne ""} {
set info [site_node::get -url $package_url]
:package_key [dict get $info package_key]
:instance_name [dict get $info instance_name]
} else {
::xo::dc 1row package_info {
select package_key, instance_name from apm_packages where package_id = :id
}
:package_key $package_key
:instance_name $instance_name
}
if {[ns_conn isconnected]} {
set root [acs::root_of_host [ad_host]]
regexp "^${root}(.*)$" $package_url _ package_url
}
:package_url $package_url
if {[info exists :url] && [info exists root]} {
regexp "^${root}(.*)$" ${:url} _ :url
} elseif {![info exists :url]} {
set :url $package_url
}
:set_url -url ${:url}
set :mime_type text/html
set :delivery ns_return
set target_class ::${:package_key}::Package
if {[:info class] ne $target_class && [:isclass $target_class]} {
:class $target_class
}
set ::xo::package_class(${:package_key}) [:info class]
:initialize
}
::xo::Package instproc insert {} {
set __table_name [[self class] table_name]
set __id [[self class] id_column]
set :$__id ${:object_id}
:log "ID insert in $__table_name, id = $__id = [set :$__id]"
next
foreach {__slot_name __slot} [[self class] array get db_slot] {
if {[info exists :$__slot_name]} {
set $__slot_name [set :$__slot_name]
lappend __vars $__slot_name
lappend __atts [$__slot column_name]
}
}
::xo::dc dml insert_$__table_name "insert into $__table_name
([join $__atts ,]) values (:[join $__vars ,:])"
}
::xo::Package instproc handle_http_caching {} {
ns_set put [ns_conn outputheaders] "Cache-Control" "max-age=0, no-cache, no-store"
}
::xo::Package instproc initialize {} {
}
::xo::Package instproc instantiate_forms {-forms:required {-default_lang ""} {-parent_id ""}} {
set form_item_ids [acs::per_request_cache eval -key xotcl-core.instantiate_forms-$forms-$default_lang-$parent_id -no_cache {} -from_cache_indicator from_cache {
set form_item_ids {}
foreach item_ref [split $forms |] {
if {![regexp {^[[:alnum:]:./_-]+$} $item_ref]} {
error "invalid form specification '$item_ref'"
}
set page [:get_page_from_item_ref -use_prototype_pages true -use_package_path true -parent_id $parent_id -default_lang $default_lang $item_ref]
if {$page ne ""} {
lappend form_item_ids [$page item_id]
}
}
set form_item_ids
}]
if {$from_cache} {
::xo::db::CrClass ensure_item_ids_instantiated -item_ids $form_item_ids
}
return $form_item_ids
}
::xo::Package instproc update {} {
::xo::dc transaction {
next
:instvar object_id package_key default_locale instance_name
::xo::dc dml update_apm_packages {update apm_packages
set package_key = :package_key,default_locale = :default_locale,instance_name = :instance_name where package_id = :object_id
}
}
}
::xo::Package instproc set_url -url {
:url $url
set :object [string range [:url] [string length [:package_url]] end]
}
::xo::Package instforward query_parameter {%set :context} %proc
::xo::Package instforward returnredirect {%set :context} %proc
::xo::Package instforward exists_form_parameter {%set :context} %proc
::xo::Package instforward form_parameter {%set :context} %proc
::xo::Package instforward exists_query_parameter {%set :context} %proc
::xo::Package instparametercmd url
::xo::Package instparametercmd default_locale
::xo::Package instparametercmd instance_name
::xo::Package instparametercmd force_refresh_login
::xo::Package instparametercmd id
::xo::Package instparametercmd package_id
::xo::Package instparametercmd package_key
::xo::Package instparametercmd context
::xo::Package instparametercmd package_url
::nsf::relation::set ::xo::Package superclass ::xo::db::Object
::nx::slotObj -container slot ::xo::Package
::xo::Package::slot eval {set :__parameter {
{id:integer}
url
{context ::xo::cc}
package_url
{force_refresh_login false}
}}
::nsf::object::alloc ::xotcl::Attribute ::xo::Package::slot::url {set :accessor public
set :configurable true
set :convert false
set :defaultmethods {}
set :disposition alias
set :domain ::xo::Package
set :incremental 0
set :manager ::xo::Package::slot::url
set :methodname url
set :multiplicity 1..1
set :name url
set :parameterSpec -url
set :per-object false
set :position 0
set :required false
set :trace none
: init}
::nsf::object::alloc ::xo::db::Attribute ::xo::Package::slot::default_locale {set :accessor public
set :column_name default_locale
set :configurable true
set :convert false
set :create_acs_attribute true
set :create_table_attribute true
set :datatype string
set :defaultmethods {}
set :disposition alias
set :domain ::xo::Package
set :incremental false
set :manager ::xo::Package::slot::default_locale
set :max_n_values 1
set :methodname default_locale
set :min_n_values 1
set :multiplicity 1..1
set :name default_locale
set :parameterSpec -default_locale
set :per-object false
set :position 0
set :pretty_name #xo.Package-default_locale#
set :pretty_plural {}
set :references {}
set :required false
set :sqltype varchar(30)
set :trace none
: init}
::nsf::object::alloc ::xo::db::Attribute ::xo::Package::slot::package_key {set :accessor public
set :column_name package_key
set :configurable true
set :convert false
set :create_acs_attribute true
set :create_table_attribute true
set :datatype string
set :defaultmethods {}
set :disposition alias
set :domain ::xo::Package
set :incremental false
set :manager ::xo::Package::slot::package_key
set :max_n_values 1
set :methodname package_key
set :min_n_values 1
set :multiplicity 1..1
set :name package_key
set :parameterSpec -package_key
set :per-object false
set :position 0
set :pretty_name #xo.Package-package_key#
set :pretty_plural {}
set :references {}
set :required false
set :sqltype varchar(100)
set :trace none
: init}
::nsf::object::alloc ::xo::db::Attribute ::xo::Package::slot::package_id {set :accessor public
set :column_name package_id
set :configurable true
set :convert false
set :create_acs_attribute false
set :create_table_attribute true
set :datatype integer
set :defaultmethods {}
set :disposition alias
set :domain ::xo::Package
set :incremental false
set :manager ::xo::Package::slot::package_id
set :max_n_values 1
set :methodname package_id
set :min_n_values 1
set :multiplicity 1..1
set :name package_id
set :per-object false
set :position 0
set :pretty_name ID
set :pretty_plural {}
set :references {}
set :required false
set :sqltype integer
set :trace none
: init}
::nsf::object::alloc ::xotcl::Attribute ::xo::Package::slot::id {set :accessor public
set :configurable true
set :convert false
set :defaultmethods {}
set :disposition alias
set :domain ::xo::Package
set :incremental 0
set :manager ::xo::Package::slot::id
set :methodname id
set :multiplicity 1..1
set :name id
set :parameterSpec -id:integer
set :per-object false
set :position 0
set :required false
set :trace none
set :type integer
: init}
::nsf::object::alloc ::xotcl::Attribute ::xo::Package::slot::force_refresh_login {set :accessor public
set :configurable true
set :convert false
set :default false
set :defaultmethods {}
set :disposition alias
set :domain ::xo::Package
set :incremental 0
set :manager ::xo::Package::slot::force_refresh_login
set :methodname force_refresh_login
set :multiplicity 1..1
set :name force_refresh_login
set :per-object false
set :position 0
set :required false
set :substdefault 0b111
set :trace none
: init}
::nsf::object::alloc ::xo::db::Attribute ::xo::Package::slot::instance_name {set :accessor public
set :column_name instance_name
set :configurable true
set :convert false
set :create_acs_attribute true
set :create_table_attribute true
set :datatype string
set :defaultmethods {}
set :disposition alias
set :domain ::xo::Package
set :incremental false
set :manager ::xo::Package::slot::instance_name
set :max_n_values 1
set :methodname instance_name
set :min_n_values 1
set :multiplicity 1..1
set :name instance_name
set :parameterSpec -instance_name
set :per-object false
set :position 0
set :pretty_name #xo.Package-instance_name#
set :pretty_plural {}
set :references {}
set :required false
set :sqltype varchar(300)
set :trace none
: init}
::nsf::object::alloc ::xotcl::Attribute ::xo::Package::slot::context {set :accessor public
set :configurable true
set :convert false
set :default ::xo::cc
set :defaultmethods {}
set :disposition alias
set :domain ::xo::Package
set :incremental 0
set :manager ::xo::Package::slot::context
set :methodname context
set :multiplicity 1..1
set :name context
set :parameterSpec {-context:substdefault ::xo::cc}
set :per-object false
set :position 0
set :required false
set :substdefault 0b111
set :trace none
: init}
::nsf::object::alloc ::xotcl::Attribute ::xo::Package::slot::package_url {set :accessor public
set :configurable true
set :convert false
set :defaultmethods {}
set :disposition alias
set :domain ::xo::Package
set :incremental 0
set :manager ::xo::Package::slot::package_url
set :methodname package_url
set :multiplicity 1..1
set :name package_url
set :parameterSpec -package_url
set :per-object false
set :position 0
set :required false
set :trace none
: init}
XQL Not present:Generic, PostgreSQL, Oracle
[
hide source ]
| [
make this the default ]