Index: openacs-4/packages/xowiki/www/ckeditor-images/thumb-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/ckeditor-images/thumb-view.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/xowiki/www/ckeditor-images/thumb-view.tcl 18 Dec 2018 16:13:04 -0000 1.8 +++ openacs-4/packages/xowiki/www/ckeditor-images/thumb-view.tcl 3 Sep 2024 15:37:55 -0000 1.9 @@ -1,41 +1,45 @@ ad_page_contract { - + + Display image attachments of an XoWiki page + } { - {parent_id:naturalnum ""} -} -validate { - parent_id_exists -requires {parent_id} { - if {[xo::dc 0or1row object_exists "select item_id from cr_items where item_id = :parent_id"] == 0} { - ad_complain "Specified item does not exist" - } - } + parent_id:object_type(cr_item),notnull } -set output "" set return_url [export_vars -base [ad_conn url] -no_empty {parent_id}] -db_multirow -extend { + +::xo::dc multirow -prepare integer -extend { delete_url download_url img_id image_p -} sub_files get_children " -select package_id,name,cr.title,cr.item_id,revision_id,mime_type, to_char(publish_date, 'yyyy-mm-dd, HH:MM') as date - from cr_items ci inner join cr_revisions cr on (ci.item_id = cr.item_id) -join acs_objects o on o.object_id=cr.item_id - where parent_id = :parent_id and revision_id = ci.live_revision - AND cr.mime_type LIKE 'image/%' - ORDER BY publish_date DESC" { - ::xowiki::Package initialize -package_id $package_id - set item [::xowiki::File get_instance_from_db -item_id $item_id] - set url [$item pretty_link] - set download_url [export_vars -base $url {{m download}}] - set delete_url [export_vars -base $url {{m delete} return_url}] - set img_id "preview-img-${revision_id}" - set image_p [expr {$mime_type in {"image/jpeg" "image/png" "image/gif"}}] - } +} sub_files get_children { + select package_id, + name, + cr.title, + cr.item_id, + revision_id, + mime_type, + to_char(publish_date, 'yyyy-mm-dd, HH:MM') as date + from cr_items ci + inner join cr_revisions cr + on ci.item_id = cr.item_id + join acs_objects o + on o.object_id = cr.item_id + where parent_id = :parent_id + and revision_id = ci.live_revision + and cr.mime_type like 'image/%' + order by publish_date desc +} { + ::xowiki::Package initialize -package_id $package_id + set item [::xowiki::File get_instance_from_db -item_id $item_id] + set url [$item pretty_link] + set download_url [export_vars -base $url {{m download}}] + set delete_url [export_vars -base $url {{m delete} return_url}] + set img_id "preview-img-${revision_id}" + set image_p [expr {$mime_type in {"image/jpeg" "image/png" "image/gif"}}] +} - -set server_url "" - # Local variables: # mode: tcl # tcl-indent-level: 2