Index: openacs-4/packages/xowiki/www/admin/list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/list.tcl,v diff -u -N --- openacs-4/packages/xowiki/www/admin/list.tcl 25 Jun 2007 12:18:57 -0000 1.15 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,146 +0,0 @@ -::xowiki::Package initialize -ad_doc { - This is the admin page for the package. It displays all entries - provides links to create, edit and delete these - - @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) - @creation-date Oct 23, 2005 - @cvs-id $Id: list.tcl,v 1.15 2007/06/25 12:18:57 gustafn Exp $ - - @param object_type show objects of this class and its subclasses -} -parameter { - {-object_type:optional} - {-orderby:optional "last_modified,desc"} -} - -set context [list index] - -# if object_type is specified, only list entries of this type; -# otherwise show types and subtypes of $supertype -if {![info exists object_type]} { - set per_type 0 - set supertype ::xowiki::Page - set object_types [$supertype object_types] - set title "List of all kind of [$supertype set pretty_plural]" - set with_subtypes true - set object_type $supertype -} else { - set per_type 1 - set object_types [list $object_type] - set title "Index of [$object_type set pretty_plural]" - set with_subtypes false -} - -set return_url [expr {$per_type ? [export_vars -base [::$package_id url] object_type] : - [::$package_id url]}] -# set up categories -set category_map_url [export_vars -base \ - [site_node::get_package_url -package_key categories]cadmin/one-object \ - { { object_id $package_id } }] - -set actions "" -foreach type $object_types { - append actions [subst { - Action new \ - -label "[_ xotcl-core.add [list type [$type pretty_name]]]" \ - -url [export_vars -base [::$package_id package_url] {{edit-new 1} {object_type $type} return_url}] \ - -tooltip "[_ xotcl-core.add_long [list type [$type pretty_name]]]" - }] -} - -set ::individual_permissions [expr {[$package_id set policy] eq "::xowiki::policy3"}] -set ::with_publish_status 1 - -TableWidget t1 -volatile \ - -actions $actions \ - -columns { - BulkAction objects -id name -actions { - Action new -label export -tooltip export -url export - } - ImageField_EditIcon edit -label "" -html {style "padding: 2px;"} - if {$::individual_permissions} { - ImageAnchorField permissions -src /resources/xowiki/permissions.png -width 16 \ - -height 16 -border 0 -title "Manage Individual Permssions for this Item" \ - -alt permsissions -label "" -html {style "padding: 2px;"} - } - if {$::with_publish_status} { - ImageAnchorField publish_status -src "" -width 8 \ - -height 8 -border 0 -title "Toggle Publish Status" \ - -alt "publish status" -label [_ xowiki.publish_status] -html {style "padding: 2px;"} - } - Field syndicated -label "RSS" -html {style "padding: 2px;"} - if {[::xo::db::has_ltree]} { - AnchorField page_order -label [_ xowiki.order] -orderby page_order -html {style "padding: 2px;"} - } - AnchorField name -label [_ xowiki.Page-name] -orderby name -html {style "padding: 2px;"} - AnchorField title -label [_ xowiki.Page-title] -orderby title - Field object_type -label [_ xowiki.page_type] -orderby object_type -html {style "padding: 2px;"} - Field size -label "Size" -orderby size -html {align right style "padding: 2px;"} - Field last_modified -label "Last Modified" -orderby last_modified - Field mod_user -label "By User" -orderby mod_user - ImageField_DeleteIcon delete -label "" ;#-html {onClick "return(confirm('Confirm delete?'));"} - } - -foreach {att order} [split $orderby ,] break -t1 orderby -order [expr {$order eq "asc" ? "increasing" : "decreasing"}] $att - -# -page_size 10 -# -page_number 1 - -set attributes [list revision_id content_length creation_user title \ - "to_char(last_modified,'YYYY-MM-DD HH24:MI:SS') as last_modified"] -if {[::xo::db::has_ltree]} { - lappend attributes page_order -} - -set folder_id [::$package_id folder_id] -foreach i [db_list get_syndicated { - select object_id from syndication s, cr_items ci - where object_id = ci.live_revision and parent_id = :folder_id -}] { set syndicated($i) 1 } - -db_foreach instance_select \ - [$object_type instance_select_query \ - -folder_id $folder_id \ - -with_subtypes $with_subtypes \ - -from_clause ", xowiki_page p" \ - -where_clause "p.page_id = cr.revision_id" \ - -select_attributes $attributes \ - -orderby ci.name \ - ] { - set page_link [::$package_id pretty_link $name] - - t1 add \ - -name $name \ - -title $title \ - -object_type [string map [list "::xowiki::" ""] $object_type] \ - -name.href $page_link \ - -last_modified $last_modified \ - -syndicated [info exists syndicated($revision_id)] \ - -size [expr {$content_length ne "" ? $content_length : 0}] \ - -edit.href [export_vars -base $page_link {{m edit} return_url}] \ - -mod_user [::xo::get_user_name $creation_user] \ - -delete.href [export_vars -base [$package_id package_url] {{delete 1} item_id name return_url}] - if {$::individual_permissions} { - [t1 last_child] set permissions.href \ - [export_vars -base permissions {item_id return_url}] - } - if {$::with_publish_status} { - # TODO: this should get some architectural support - if {$publish_status eq "ready"} { - set image active.png - set state "production" - } else { - set image inactive.png - set state "ready" - } - [t1 last_child] set publish_status.src /resources/xowiki/$image - [t1 last_child] set publish_status.href \ - [export_vars -base [$package_id package_url]admin/set-publish-state \ - {state revision_id return_url}] - } - if {[::xo::db::has_ltree]} { - [t1 last_child] set page_order $page_order - } - } - -set t1 [t1 asHTML]