- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::Includelet
::xowiki::Includelet create ... \
[ -__decoration (default "portlet") ] \
[ -id id ] \
[ -name (default "") ] \
[ -parameter_declaration (default "") ] \
[ -title (default "") ]
Defined in
Class Relations
- class: ::xotcl::Class
- superclass: ::xo::Context
- subclass: ::xowiki::includelet::categories-recent, ::xowiki::includelet::presence, ::xowiki::includelet::recent, ::xowiki::includelet::unresolved-references, ::xowiki::includelet::form-stats, ::xowiki::includelet::link-with-local-return-url, ::xowiki::includelet::personal-notification-messages, ::xowiki::includelet::wf-todo, ::xowiki::includelet::available-includelets, ::xowiki::includelet::folders, ::xowiki::includelet::toc, ::xowiki::includelet::item-button, ::xowiki::includelet::set-parameter, ::xowiki::includelet::my-refers, ::xowiki::includelet::last-visited, ::xowiki::includelet::references-graph, ::xowiki::includelet::current-irc-log, ::xowiki::includelet::LTI-LaunchButton, ::xowiki::includelet::flowplayer, ::xowiki::includelet::graph, ::xowiki::includelet::get, ::xowiki::includelet::most-popular, ::xowiki::includelet::my-categories, ::xowiki::includelet::creation-date, ::xowiki::includelet::html-file, ::xowiki::includelet::random-form-page, ::xowiki::includelet::exam-top-includelet, ::xowiki::includelet::s5, ::xowiki::includelet::iframe, ::xowiki::includelet::digg, ::xowiki::includelet::community-link, ::xowiki::includelet::available-formfields, ::xowiki::includelet::chat_room, ::xowiki::includelet::form-menu, ::xowiki::includelet::unread-items, ::xowiki::includelet::categories, ::xowiki::includelet::rss-button, ::xowiki::includelet::vspace, ::xowiki::includelet::yui-carousel, ::xowiki::includelet::my-references, ::xowiki::includelet::my-yahoo-publisher, ::xowiki::includelet::timeline, ::xowiki::includelet::kibana, ::xowiki::includelet::most-frequent-visitors, ::xowiki::includelet::form-usages, ::xowiki::includelet::chat, ::xowiki::includelet::book, ::xowiki::includelet::child-resources, ::xowiki::includelet::delicious, ::xowiki::includelet::selection, ::xowiki::includelet::countdown-timer, ::xowiki::includelet::my-tags, ::xowiki::includelet::tags, ::xowiki::includelet::bookmarklet-button, ::xowiki::includelet::gravatar, ::xowiki::includelet::rss-client, ::xowiki::includelet::my-general-comments
::xotcl::Class create ::xowiki::Includelet \ -superclass ::xo::ContextMethods (to be applied on the object)
available_includelets (scripted)
unset -nocomplain :html :describe_includelets [::xowiki::Includelet info subclass] set result "<ul>" foreach d [lsort [array names :html]] { append result "<li>" [set :html($d)] "</li>" \n } append result "</ul>" return $resultdescribe_includelets (scripted)
#:log "--plc=$includelet_classes " foreach cl $includelet_classes { set result "" append result "{{<b>[namespace tail $cl]</b>" foreach p [$cl info parameter] { if {[llength $p] != 2} continue lassign $p name value if {$name eq "parameter_declaration"} { foreach pp $value { #append result "" switch [llength $pp] { 1 {append result " $pp"} 2 { set v [lindex $pp 1] if {$v eq ""} {set v {""}} append result " [lindex $pp 0] <em>[ns_quotehtml $v]</em>" } } #append result "\n" } } } append result "}}\n<p>" set index [::xo::api object_index "" $cl] if {[nsv_exists api_library_doc $index]} { set doc_elements [nsv_get api_library_doc $index] append result [lindex [dict get $doc_elements main] 0] } set :html([namespace tail $cl]) $result :describe_includelets [$cl info subclass] }glob_clause (scripted)
# Return a clause for name matching. # value uses * for matching set glob [string map [list * %] $value] return " and $base_table.$attribute like '$glob'"html_encode (scripted)
xowiki::Includelet html_encode# ' is not a known entity to some validators, so we use the # numerical entity here for encoding "'" return [string map [list & "&" < "<" > ">" \" """ ' "'"] $string]html_id (scripted)
# Construct a valid HTML id or name. # For details, see http://www.w3.org/TR/html4/types.html # # For XOTcl object names, strip first the colons set name [string trimleft $name :] # make sure, the ID starts with characters if {![regexp {^[A-Za-z]} $name]} { set name id_$name } # replace unwanted characters regsub -all -- {[^A-Za-z0-9_.-]} $name _ name return $namehtml_to_text (scripted)
return [string map [list "&" &] $string]js_encode (scripted)
string map [list \n \\n \" {\"} ' {\'}] $stringjs_name (scripted)
return ID[string map [list : _ # _] $name]listing (scripted)
if {$count} { set attribute_selection "count(*)" set orderby "" ;# no need to order when we count set page_number "" ;# no pagination when count is used } else { set attribute_selection "i.name, r.title, p.page_id, r.publish_date, r.mime_type, i.parent_id, o.package_id, to_char(r.publish_date,'YYYY-MM-DD HH24:MI:SS') as formatted_date" } if {$page_number ne ""} { set limit $page_size set offset [expr {$page_size*($page_number-1)}] } else { set limit "" set offset "" } set parent_id_clause [::xowiki::Includelet parent_id_clause -base_table i -use_package_path $use_package_path -parent_id $parent_id -base_package_id $package_id] if {$glob ne ""} { append extra_where_clause [::xowiki::Includelet glob_clause -base_table i $glob] } set sql [::xo::dc select -vars $attribute_selection -from "cr_items i, cr_revisions r, xowiki_page p, acs_objects o" -where "$parent_id_clause and r.revision_id = i.live_revision and i.item_id = o.object_id and p.page_id = r.revision_id and i.publish_status <> 'production' $extra_where_clause" -orderby $orderby -limit $limit -offset $offset] if {$count} { return [::xo::dc get_value count_listing $sql] } else { set s [::xowiki::Page instantiate_objects -sql $sql] return $s }locale_clause (scripted)
set default_locale [::$package_id default_locale] set system_locale "" set with_system_locale [regexp {(.*)[+]system} $locale _ locale] if {$locale eq "default"} { set locale $default_locale set include_system_locale 0 } #:msg "--L with_system_locale=$with_system_locale, locale=$locale, default_locale=$default_locale" set locale_clause "" if {$locale ne ""} { set locale_clause " and $revisions.nls_language = '$locale'" if {$with_system_locale} { set system_locale [lang::system::locale -package_id $package_id] #:msg "system_locale=$system_locale, default_locale=$default_locale" if {$system_locale ne $default_locale} { set locale_clause " and ($revisions.nls_language = '$locale' or $revisions.nls_language = '$system_locale' and not exists (select 1 from cr_items i where i.name = '[string range $locale 0 1]:' || substring($items.name,4) and i.parent_id = $items.parent_id))" } } } #:msg "--locale $locale, def=$default_locale sys=$system_locale, cl=$locale_clause locale_clause=$locale_clause" return [list $locale $locale_clause]parent_id_clause (scripted)
# # Get the package path and from it, the folder_ids. The parent_id # of the returned pages should be a direct child of the folder. # if {$parent_id eq ""} { set parent_id [::$base_package_id folder_id] } set packages [::$base_package_id package_path] if {$use_package_path && [llength $packages] > 0} { set parent_ids [list $parent_id] foreach p $packages {lappend parent_ids [$p folder_id]} return "$base_table.parent_id in ([ns_dbquotelist $parent_ids])" } else { return "$base_table.parent_id = [ns_dbquotevalue $parent_id]" }publish_status_clause (scripted)
set table_prefix "" if {$base_table ne ""} { set table_prefix "$base_table." } set publish_status_clause "" if {$value ne "all"} { set valid_states {production ready live expired} set clauses [list] foreach state [split $value |] { if {$state ni $valid_states} { error "no such state: '$state'; valid states are: production, ready, live, expired" } lappend clauses "${table_prefix}publish_status='$state'" } if {[llength $clauses] > 0} { set publish_status_clause " and ([join $clauses { or }])" } } return $publish_status_clauserequire_YUI_CSS (scripted)
if {$ajaxhelper} { ::xo::Page requireCSS "/resources/ajaxhelper/yui/$path" } else { ::xo::Page requireCSS "//yui.yahooapis.com/$version/build/$path" security::csp::require style-src yui.yahooapis.com }require_YUI_JS (scripted)
if {$ajaxhelper} { ::xo::Page requireJS "/resources/ajaxhelper/yui/$path" } else { ::xo::Page requireJS "//yui.yahooapis.com/$version/build/$path" security::csp::require script-src yui.yahooapis.com }Methods (to be applied on instances)
__decoration (setter)
category_clause (scripted)
# the category_spec has the syntax "a,b,c|d,e", where the values are category_ids # pipe symbols are or-operations, commas are and-operations; # no parenthesis are permitted set extra_where_clause "" set or_names [list] set ors [list] foreach cid_or [split $category_spec |] { set ands [list] set and_names [list] foreach cid_and [split $cid_or ,] { if {![nsf::is integer $cid_and]} { ad_return_complaint 1 "invalid category id '$cid_and'" ad_script_abort } lappend and_names [::category::get_name $cid_and] lappend ands "exists (select 1 from category_object_map where object_id = $item_ref and category_id = [ns_dbquotevalue $cid_and])" } lappend or_names [join $and_names { and }] lappend ors "([join $ands { and }])" } if {$ors eq "()"} { set cnames "" } else { set cnames [join $or_names { or }] set extra_where_clause "and ([join $ors { or }])" } #:log "--cnames $category_spec -> $cnames // <$extra_where_clause>" return [list $cnames $extra_where_clause]get_current_folder (scripted)
set package_id [${:__including_page} package_id] #:log "get_current_folder: including_page current_folder $current_folder '[$current_folder name]'" if {$parent eq ".."} { set current_folder [${:__including_page} parent_id] ::xo::db::CrClass get_instance_from_db -item_id $current_folder } elseif {$parent eq "."} { set current_folder ${:__including_page} } elseif {$parent eq "/"} { # set current_folder to the package folder set current_folder [::$package_id folder_id] } else { set page [::$package_id get_page_from_item_ref -use_package_path true -use_site_wide_pages true -use_prototype_pages true -default_lang [string range ${:locale} 0 1] -parent_id [${:__including_page} parent_id] $parent] if {$page ne ""} { set current_folder $page } else { ns_log warning "could not fetch folder via item_ref '$parent'" set current_folder ${:__including_page} } } #:log "get_current_folder: parent $parent, current_folder $current_folder '[$current_folder name]', folder is formPage [$current_folder istype ::xowiki::FormPage]" if {![$current_folder istype ::xowiki::FormPage]} { # current folder has to be a FormPage set current_folder [$current_folder parent_id] #:log "###### use parent of current folder $current_folder '[$current_folder name]'" if {![$current_folder istype ::xowiki::FormPage]} { error "get_current_folder not included from a FormPage" } } return $current_folderget_page_order (scripted)
# # first check, if we can load the page_order from the page # denoted by source # if {[info exists source]} { set p [:resolve_page_name $source] if {$p ne ""} { set ia [$p set instance_attributes] if {[dict exists $ia pages]} { set pages [dict get $ia pages] } elseif {[dict exists $ia ordered_pages]} { set ordered_pages [dict get $ia ordered_pages] } } } # compute a list of ordered_pages from pages, if necessary if {[info exists ordered_pages]} { foreach {order page} $ordered_pages {set :page_order($page) $order} } else { set i 0 foreach page $pages {set :page_order($page) [incr i]} }id (setter)
include_head_entries (scripted)
# The purpose of this method is to contain all calls to include # CSS files, JavaScript, etc. in the HTML head. This kind of # requirement could as well be included e.g. in render, but this # won't work, when the result of "render" is cached. This method # is called before render to be executed even when render is not # due to caching. It is intended to be overloaded by subclasses.initialize (scripted)
# This method is called at a time after init and before render. # It can be used to alter specified parameter from the user, # or to influence the rendering of a decoration (e.g. title etc.)js_name (scripted)
return [[self class] js_name [self]]name (setter)
parameter_declaration (setter)
resolve_page_name (scripted)
return [${:__including_page} resolve_included_page_name $page_name]screen_name (scripted)
set screen_name [acs_user::get_user_info -user_id $user_id -element screen_name] if {$screen_name eq ""} { set screen_name [person::get_person_info -person_id $user_id -element name] } return $screen_nametableWidget (scripted)
return [expr {[::template::CSS toolkit] in {bootstrap5 bootstrap} ? "::xowiki::BootstrapTable" : "TableWidget" }]title (setter)
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables