::xowiki::IncludeletClass
::xowiki::includelet::random-form-page
Class Hierarchy of ::xowiki::includelet::random-form-page
- ::xotcl::Object
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- 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::Context
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Parameter for instances:
- actual_query (default " "), locale, package_id (default "0"), parameter_declaration (default "")
- Methods for instances:
- exists_query_parameter, export_vars, get_all_query_parameter, get_parameters, initialize, original_url_and_query, process_query_parameter, query_parameter
- Methods to be applied on the class:
- Methods provided by the meta-class
- ::xowiki::Includelet
- Meta-class:
- ::xotcl::Class
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Parameter for instances:
- __decoration (default "portlet"), id, name (default ""), parameter_declaration (default ""), title (default "")
- Methods for instances:
- category_clause, get_page_order, include_head_entries, initialize, js_name, resolve_page_name, screen_name
- Methods to be applied on the class (in addition to the methods provided by the meta-class):
- available_includelets, describe_includelets, glob_clause, html_encode, html_id, html_to_text, js_encode, js_name, listing, locale_clause, parent_id_clause, publish_status_clause, require_YUI_CSS, require_YUI_JS
- ::xowiki::includelet::random-form-page
- Meta-class:
- ::xowiki::IncludeletClass
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Parameter for instances:
- __decoration (default "none"), parameter_declaration (default "
{-form:required}
{-publish_status "ready"}
{-expires 600}
")
- Methods for instances:
- render
- Methods to be applied on the class (in addition to the methods provided by the meta-class):
- page_names
Class Relations
- superclass: ::xowiki::Includelet
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xowiki::IncludeletClass create ::xowiki::includelet::random-form-page \
-superclass ::xowiki::Includelet \
-parameter {{__decoration none} {parameter_declaration {
{-form:required}
{-publish_status "ready"}
{-expires 600}
}}}
Methods
proc page_names
::xowiki::policy5 proc page_names {package_id form publish_status} {
#
# This is a cacheable method returing a list of the names from
# which the random page is selected. We use a class method and the
# argument list with util_memoize inability to provide a key for
# caching.
#
set form_item_ids [::xowiki::Weblog instantiate_forms -forms $form -package_id $package_id]
set form_fields [::xowiki::FormPage get_table_form_fields -base_item [lindex $form_item_ids 0] -field_names _name -form_constraints ""]
set items [::xowiki::FormPage get_form_entries -base_item_ids $form_item_ids -form_fields $form_fields -initialize false -publish_status $publish_status -package_id $package_id]
set result [list]
foreach item [$items children] {
lappend result [$item name]
}
return $result
}
instproc render
::xowiki::policy5 instproc render {} {
my get_parameters
set cmd [list ::xowiki::includelet::random-form-page page_names $package_id $form $publish_status]
if {[ns_info name] eq "NaviServer"} {
set names [ns_cache_eval -expires $expires xowiki_cache random-$package_id-$form $cmd]
} else {
set names [util_memoize $cmd]
}
set random_item [lindex $names [expr { int([llength $names] * rand()) }]]
if {$random_item eq ""} {
return ""
} {
return [[my set __including_page] include [list $random_item -decoration none]]
}
}
Variables
::xowiki::includelet::random-form-page set __default_metaclass ::xotcl::Class
::xowiki::includelet::random-form-page set __default_superclass ::xotcl::Object
::xowiki::includelet::random-form-page set aggregating false
::xowiki::includelet::random-form-page set cacheable false
::xowiki::includelet::random-form-page set localized true
::xowiki::includelet::random-form-page set personalized true