- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::includelet::child-resources
::xowiki::includelet::child-resources create ... \
[ -parameter_declaration (default " {-skin:optional "yui-skin-sam"} {-show_types "::xowiki::Page,::xowiki::File,::xowiki::Form,::xowiki::FormPage"} {-regexp:optional} {-language_specific:boolean false} {-with_subtypes:boolean,optional false} {-orderby:token,optional "last_modified,desc"} {-publish_status:wordchar "ready"} {-view_target ""} {-html-content} {-parent .} {-columns { objects edit publish_status object_type name last_modified mod_user duplicate delete }} {-hide {}} {-menubar ""} ") ]
Defined in
Class Relations
::xowiki::IncludeletClass create ::xowiki::includelet::child-resources \ -superclass ::xowiki::IncludeletMethods (to be applied on instances)
render (scripted)
<instance of xowiki::includelet::child-resources> render
- Testcases:
- includelet_childresources, xowiki
:get_parameters set current_folder [:get_current_folder $parent] set :current_folder_id [$current_folder item_id] set logical_folder_id ${:current_folder_id} if {[$current_folder exists physical_item_id]} { set :current_folder_id [$current_folder set physical_item_id] } if {[::xo::cc query_parameter m:token] ne "list"} { set index [$current_folder property index] #:log "child-resources: current folder $current_folder has index <$index>" if {$index ne ""} { set download [string match "file:*" $index] #:log "child-resources: lookup index under [$current_folder item_id] ${:current_folder_id}" set index_link [::$package_id pretty_link -parent_id ${:current_folder_id} -download $download $index] return [::$package_id returnredirect $index_link] } } #::$package_id instvar package_key set current_folder_pretty_link [$current_folder pretty_link] set return_url [ad_return_url -default_url $current_folder_pretty_link] set category_url [export_vars -base [::$package_id package_url] { {manage-categories 1} {object_id $package_id} }] set all_columns {objects edit object_type name title last_modified mod_user duplicate delete} foreach column $all_columns { set ::hidden($column) [expr {$column ni $columns || $column in $hide}] } # # We have to use the global variable for the time being due to # scoping in "-columns" set ::__xowiki_with_publish_status [expr { $publish_status ne "ready" || "publish_status" in $columns}] # unexisting csrf token usually means we are outside a connection thread set csrf [expr {[info exists ::__csrf_token] ? [list __csrf_token $::__csrf_token] : ""}] set ::__xowiki_folder_link [::$package_id make_link -link $current_folder_pretty_link $current_folder bulk-delete $csrf return_url] switch [::template::CSS toolkit] { bootstrap5 - bootstrap {set tableWidgetClass ::xowiki::BootstrapTable} default {set tableWidgetClass ::xowiki::YUIDataTable} } set t [$tableWidgetClass new -volatile -skin $skin -columns { if {!$::hidden(objects)} { BulkAction create objects -id ID -actions { if {$::__xowiki_folder_link ne ""} { Action bulk-delete -label [_ xowiki.delete] -tooltip [_ xowiki.Delete_selected] -url $::__xowiki_folder_link -confirm_message [_ xowiki.delete_confirm] } } } # The "-html" options are currently ignored in the YUI # DataTable. Not sure, it can be integrated in the traditional way. # HiddenField create ID AnchorField create edit -CSSclass edit-item-button -label "" -hide $::hidden(edit) AnchorField create duplicate -CSSclass copy-item-button -hide $::hidden(duplicate) -label "" if {$::__xowiki_with_publish_status} { AnchorField create publish_status -CSSclass publish-status-item-button -orderby publish_status.CSSclass -label "" -richtext 1 } Field create object_type -label [_ xowiki.page_kind] -orderby object_type -richtext false -hide $::hidden(object_type) AnchorField create name -label [_ xowiki.name] -orderby name -hide $::hidden(name) AnchorField create title -label [_ xowiki.title] -orderby title -hide $::hidden(title) Field create last_modified -label [_ xowiki.Page-last_modified] -orderby last_modified -hide $::hidden(last_modified) Field create mod_user -label [_ xowiki.By_user] -orderby mod_user -hide $::hidden(mod_user) AnchorField create delete -CSSclass delete-item-button -hide $::hidden(delete) -label "" }] set extra_where_clause "1=1" # TODO: why filter on title and name? if {[info exists regexp]} { set extra_where_clause "(bt.title ~ '$regexp' OR ci.name ~ '$regexp' )" } if {$language_specific} { # # Setting the property language_specific does two things: # a) filter the entries by this language # b) change the title of the folder when a property ml_title is supplied. # set lang [string range [:locale] 0 1] set extra_where_clause "ci.name like '${lang}:%'" # # Update the title to a language-specific value # $current_folder update_langstring_property _title $lang #:msg "$current_folder update_langstring_property _title $lang -> [$current_folder title]" } #:log "child-resources of folder_id ${:current_folder_id} with publish_status '$publish_status'" set items [::xowiki::FormPage get_all_children -folder_id ${:current_folder_id} -publish_status $publish_status -object_types [:types_to_show] -extra_where_clause $extra_where_clause] set package_id [::xo::cc package_id] set pkg ::$package_id set url [::xo::cc url] $pkg get_lang_and_name -default_lang "" -name [$current_folder name] lang name set folder [$pkg folder_path -parent_id [$current_folder parent_id]] set folder_ids [$items set folder_ids] foreach c [$items children] { set name [$c name] #:log "===###=== child-resources: get link for $name under ::$package_id logical_folder_id $logical_folder_id" #set ::DDD 1 set page_link [::$package_id pretty_link -parent_id $logical_folder_id -context_url $url -folder_ids $folder_ids -path_encode false -page $c $name] #:log "===###=== child-resources: get link for $name under ::$package_id -> $page_link" #unset ::DDD set icon [$c render_icon] ad_try { set prettyName [$c pretty_name] } on error {errorMsg} { :msg "can't obtain pretty name of [$c name] (item_id [$c item_id]): $errorMsg" set prettyName $name } # -ID $page_link $t add -ID [$c item_id] -name $prettyName -name.href [export_vars -base $page_link {template_file html-content}] -name.title [$c set title] -title [$c set title] -title.href [export_vars -base $page_link {template_file html-content}] -object_type [dict get $icon text] -object_type.richtext [dict get $icon is_richtext] -last_modified [$c set last_modified] -edit "" -edit.href [export_vars -base $page_link {{m:token edit} return_url}] -edit.title #xowiki.edit# -mod_user [::xo::get_user_name [$c set creation_user]] -duplicate "" -duplicate.href [export_vars -base $page_link {{m:token duplicate} return_url}] -duplicate.title #xowiki.duplicate# -delete "" -delete.href [export_vars -base $page_link {{m:token delete} return_url}] -delete.title #xowiki.delete# if {$::__xowiki_with_publish_status} { # TODO: this should get some architectural support set publish_status [$c set publish_status] if {$publish_status eq "ready"} { set CSSclass green set state "production" } elseif {$publish_status eq "expired"} { set CSSclass black set state "production" } else { set CSSclass red set state "ready" } set line [$t last_child] $line set publish_status "■" $line set publish_status.CSSclass $CSSclass $line set publish_status.title #xowiki.publish_status_make_$state# $line set publish_status.href [export_vars -base $page_link {{m toggle-publish-status} return_url}] } } set sort_names [$t column_names] lappend sort_names {*}[lmap n $sort_names {set _ $n.CSSclass}] lassign [split $orderby ,] att order if {$att in $sort_names} { $t orderby -order [expr {$order eq "asc" ? "increasing" : "decreasing"}] $att } else { ad_log warning "Ignore invalid sorting criterion '$att' (valid: $sort_names)" util_user_message -message "Ignore invalid sorting criterion '$att'" } # if {$menubar ne ""} { # set mb [::xowiki::MenuBar new -id submenubar] # # for now, just the first group # lassign $menubar Menu entries # $mb add_menu -name $Menu # set menuEntries {} # foreach e $entries { # switch -- $e { # ::xowiki::File { # lappend menuEntries {entry -name New.File -label File -object_type ::xowiki::File} # } # default {ns_log notice "can't handle $e in submenubar so far"} # } # } # ns_log notice "================= 2nd call update_items" # $mb update_items # -package_id $package_id # -parent_id ${:current_folder_id} # -return_url $return_url # -nls_language [$current_folder get_nls_language_from_lang [::xo::cc lang]] # set menubar [$mb render-preferred] # } #ns_log notice "sub-menubar: 2nd update_items needed? menubar <$menubar>" set viewers [util_coalesce [$current_folder property viewers] [$current_folder get_parameter viewers]] set viewer_links "" foreach v $viewers { set wf_link "${v}?p.folder=[$current_folder name]" append wf_link "&m=create-or-use" append viewer_links [subst -nocommands -nobackslashes { <li><a href="[ns_quotehtml $wf_link]">view with $v</a></li> }] } return "$menubar<ul>$viewer_links</ul> [$t asHTML]"Variables
::xowiki::includelet::child-resources set __default_metaclass ::xotcl::Class ::xowiki::includelet::child-resources set __default_superclass ::xotcl::Object ::xowiki::includelet::child-resources set aggregating false ::xowiki::includelet::child-resources set cacheable false ::xowiki::includelet::child-resources set localized true ::xowiki::includelet::child-resources set personalized true
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables