::xowiki::IncludeletClass
::xowiki::includelet::yui-carousel
Class Hierarchy of ::xowiki::includelet::yui-carousel
- ::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::yui-carousel
- Meta-class:
- ::xowiki::IncludeletClass
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- Parameter for instances:
- parameter_declaration (default "
{-title ""}
{-item_size 600x400}
{-image_size}
{-num_visible 1}
{-play_interval 0}
{-auto_size 0}
{-folder}
{-glob ""}
{-form ""}
")
- Methods for instances:
- form_images, images, render
- Methods to be applied on the class:
- Methods provided by the meta-class
Class Relations
- superclass: ::xowiki::Includelet
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xowiki::IncludeletClass create ::xowiki::includelet::yui-carousel \
-superclass ::xowiki::Includelet \
-parameter {{parameter_declaration {
{-title ""}
{-item_size 600x400}
{-image_size}
{-num_visible 1}
{-play_interval 0}
{-auto_size 0}
{-folder}
{-glob ""}
{-form ""}
}}}
Methods
instproc form_images
::xowiki::policy5 instproc form_images {-package_id -parent_id {-form "en:photo.form"} {-glob ""} {-width ""} {-height ""}} {
set form_item_ids [::xowiki::Weblog instantiate_forms -parent_id $parent_id -forms $form -package_id $package_id]
if {$form_item_ids eq ""} {error "could not find en:photo.form"}
set form_item_id [lindex $form_item_ids 0]
set items [::xowiki::FormPage get_form_entries -base_item_ids $form_item_ids -form_fields "" -publish_status all -always_queried_attributes * -parent_id $parent_id -package_id $package_id]
#my msg "parent-id=$parent_id, glob=$glob entries=[llength [$items children]]"
foreach entry [$items children] {
# order?
set image_name [$entry property image]
if {$glob ne "" && ![string match $glob $image_name]} {
$items delete $entry
continue
}
if {![info exists entry_field_names]} {
set entry_field_names [$entry field_names]
set entry_form_fields [::xowiki::FormPage get_table_form_fields -base_item $form_item_id -field_names $entry_field_names -form_constraints [$form_item_id set form_constraints]]
foreach fn $entry_field_names f $entry_form_fields {set ff($fn) $f}
}
$entry load_values_into_form_fields $entry_form_fields
foreach f $entry_form_fields {$f object $entry}
if {[info exists ff(image)]} {
if {$width ne ""} {$ff(image) width $width}
if {$height ne ""} {$ff(image) height $height}
if {$width ne "" && $height ne ""} {
$ff(image) set geometry "${width}x${height}"
}
$ff(image) label [$entry property _title]
}
$entry set html [$entry render_content]
#my log html=[$entry set html]
}
return $items
}
instproc images
::xowiki::policy5 instproc images {-package_id -parent_id {-glob ""} {-width ""} {-height ""}} {
set size_info ""
if {$width ne ""} {append size_info " width='$width'"}
if {$height ne ""} {append size_info " height='$height'"}
if {$width ne "" && $height ne ""} {
set geometry "?geometry=${width}x${height}"
} else {
set geometry ""
}
set listing [::xowiki::Includelet listing -package_id $package_id -parent_id $parent_id -use_package_path false -extra_where_clause " and mime_type like 'image/%'" -orderby "name asc" -glob $glob]
#my msg "parent-id=$parent_id, glob=$glob entries=[llength [$listing children]]"
foreach entry [$listing children] {
$entry class ::xowiki::Page
$entry set html "<img src='[$entry pretty_link -download true]$geometry' $size_info> <h2>[$entry title]</h2>"
}
return $listing
}
instproc render
::xowiki::policy5 instproc render {} {
my get_parameters
set ajaxhelper 1
::xowiki::Includelet require_YUI_CSS -ajaxhelper $ajaxhelper carousel/assets/skins/sam/carousel.css
::xowiki::Includelet require_YUI_JS -ajaxhelper $ajaxhelper "yahoo-dom-event/yahoo-dom-event.js"
::xowiki::Includelet require_YUI_JS -ajaxhelper $ajaxhelper "connection/connection-min.js"
::xowiki::Includelet require_YUI_JS -ajaxhelper $ajaxhelper "animation/animation-min.js"
::xowiki::Includelet require_YUI_JS -ajaxhelper $ajaxhelper "element/element-min.js"
::xowiki::Includelet require_YUI_JS -ajaxhelper $ajaxhelper "carousel/carousel-min.js"
::xo::Page set_property body class "yui-skin-sam "
if {![regexp {^(.*)x(.*)$} $item_size _ item_width item_height]} {
error "invalid item size '$item_size'; use e.g. 300x240"
}
if {[info exists image_size]} {
if {![regexp {^(.*)x(.*)$} $image_size _ width height]} {
error "invalid image size '$image_size'; use e.g. 300x240"
}
} elseif {$auto_size} {
set width $item_width
set height $item_height
} else {
set width ""
set height ""
}
set ID container_[::xowiki::Includelet html_id [self]]
set play_interval [expr {int($play_interval * 1000)}]
::xo::Page requireJS [subst {
YAHOO.util.Event.onDOMReady(function (ev) {
var carousel = new YAHOO.widget.Carousel("$ID",{
isCircular: true, numVisible: $num_visible,
autoPlayInterval: $play_interval, animation: {speed: 1.0}
});
carousel.render(); // get ready for rendering the widget
carousel.show(); // display the widget
});
}]
::xo::Page requireStyle [subst {
\#$ID {
margin: 0 auto;
}
.yui-carousel-element .yui-carousel-item-selected {
opacity: 1;
}
.yui-carousel-element li {
height: ${item_height}px;
width: ${item_width}px;
}
.yui-skin-sam .yui-carousel-nav ul li {
margin: 0;
}}]
set parent_id [[my set __including_page] parent_id]
if {[info exists folder]} {
set folder_page [$package_id get_page_from_item_ref -parent_id $parent_id $folder]
if {$folder_page eq ""} {
error "no such folder '$folder'"
} else {
set parent_id [$folder_page item_id]
}
}
set content "<div id='$ID'><ol>\n"
if {$form ne ""} {
set images [my form_images -package_id $package_id -parent_id $parent_id -form $form -glob $glob -width $width -height $height]
} else {
set images [my images -package_id $package_id -parent_id $parent_id -glob $glob -width $width -height $height]
}
foreach entry [$images children] {
append content "<li class='item'> [$entry set html] </li>\n"
}
append content "</ol></div>\n<div id='spotlight'></div>\n"
#if {$title eq ""} {set title $url}
return $content
}