xowiki::includelet::child-resources instproc render
<instance of xowiki::includelet::child-resources> render
Defined in
- Testcases:
-
includelet_childresources, xowiki
Source code:
: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]
if {$index ne ""} {
set download [string match "file:*" $index]
set index_link [::$package_id pretty_link -parent_id ${:current_folder_id} -download $download $index]
return [::$package_id returnredirect $index_link]
}
}
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}]
}
set ::__xowiki_with_publish_status [expr {
$publish_status ne "ready"
|| "publish_status" in $columns}]
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]
}
}
}
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"
if {[info exists regexp]} {
set extra_where_clause "(bt.title ~ '$regexp' OR ci.name ~ '$regexp' )"
}
if {$language_specific} {
set lang [string range [:locale] 0 1]
set extra_where_clause "ci.name like '${lang}:%'"
$current_folder update_langstring_property _title $lang
}
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]
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]
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
}
$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} {
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'"
}
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]"
XQL Not present:Generic, PostgreSQL, Oracle
[
hide source ]
| [
make this the default ]