Index: openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl,v diff -u -r1.11.2.26 -r1.11.2.27 --- openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl 20 Aug 2022 15:43:59 -0000 1.11.2.26 +++ openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl 21 Aug 2022 16:46:07 -0000 1.11.2.27 @@ -11,7 +11,8 @@ ::xo::library require -package xotcl-core 30-widget-procs namespace eval ::xowiki { - # minimal implementation of Bootstrap "navbar" + # + # Minimal implementation of Bootstrap "navbar" # currently only "dropdown" elements are supported within the navbar # TODO: add support to include: # - forms @@ -174,7 +175,7 @@ var dropZone = document.getElementById('drop-zone'); var uploadForm = document.getElementById('js-upload-form'); var progressBar = document.getElementById('dropzone-progress-bar'); - var dropZoneResponse = document.getElementById('iconified-files-wrapper'); + var dropZoneResponse = document.getElementById('thumbnail-files-wrapper'); var uploadFileRunning = 0; var uploadFilesStatus = []; var uploadFilesResponse = []; @@ -228,7 +229,7 @@ // web page. dropZoneResponse.innerHTML = uploadFilesResponse[uploadFilesResponse.length-1]; - dropZoneResponse.querySelectorAll('.drop-file').forEach(el => iconified_file_setup(el)); + dropZoneResponse.querySelectorAll('.thumbnail-file').forEach(el => thumbnail_files_setup(el)); } if (uploadFileRunning < 1) { if (dropZoneResponse) { Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -r1.332.2.120 -r1.332.2.121 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 17 Aug 2022 17:06:56 -0000 1.332.2.120 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 21 Aug 2022 16:46:07 -0000 1.332.2.121 @@ -24,6 +24,57 @@ return ${:preferredCSSToolkit} } + :public object method icon_name {filename} { + # + # Return an icon name for the proved filename + # + # Default icon name + set iconName file + if {${:iconset} eq "bootstrap-icons"} { + switch [ad_file extension $filename] { + .doc - + .docx - + .odt - + .txt {set iconName "file-earmark-text"} + + .csv - + .ods - + .xls - + .xlsx {set iconName "file-earmark-spreadsheet"} + + .odp - + .ppt - + .pptx {set iconName "file-earmark-spreadsheet"} + + .pdf {set iconName "file-earmark-pdf"} + + .c - + .h - + .tcl {set iconName "file-earmark-code"} + + .css - + .html - + .java - + .js - + .json - + .py - + .sql {set iconName "filetype-[string range [ad_file extension $filename] 1 end]"} + + default { + switch -glob [ns_guesstype $filename] { + image/* {set iconName "file-earmark-image"} + video/* {set iconName "file-earmark-play"} + audio/* {set iconName "file-earmark-slides"} + default { + ns_log notice "not handled '[ad_file extension $filename] / [ns_guesstype $filename] of <$filename>" + } + } + } + } + } + return $iconName + } + :public object method require_toolkit {{-css:switch} {-js:switch}} { # # Make sure that the preferred toolkit is loaded. Not that some @@ -85,6 +136,10 @@ set paramValue yui } } + + # + # Just do initialization once + # if {[info exists :preferredCSSToolkit] && ${:preferredCSSToolkit} eq $paramValue } { @@ -95,6 +150,7 @@ # object or on changes of the preferredCSSToolkit. # set :preferredCSSToolkit $paramValue + set :iconset [template::iconset] if {${:preferredCSSToolkit} eq "bootstrap"} { set :cssClasses { Index: openacs-4/packages/xowiki/tcl/xowiki-uploader-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-uploader-procs.tcl,v diff -u -r1.3.2.4 -r1.3.2.5 --- openacs-4/packages/xowiki/tcl/xowiki-uploader-procs.tcl 20 Aug 2022 15:44:00 -0000 1.3.2.4 +++ openacs-4/packages/xowiki/tcl/xowiki-uploader-procs.tcl 21 Aug 2022 16:46:07 -0000 1.3.2.5 @@ -61,7 +61,7 @@ :public method store_file {} { set d [next] if {[dict get $d status_code] in {200 201}} { - return [list status_code 201 message [${:parent_object} render_iconified $d]] + return [list status_code 201 message [${:parent_object} render_thumbnails $d]] } return {status_code 500 message "something wrong"} } Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v diff -u -r1.368.2.128 -r1.368.2.129 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 20 Aug 2022 15:44:00 -0000 1.368.2.128 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 21 Aug 2022 16:46:07 -0000 1.368.2.129 @@ -1527,9 +1527,9 @@ ad_script_abort } - FormPage ad_instproc render_iconified {upload_info} { + FormPage ad_instproc render_thumbnails {upload_info} { - Renderer of the iconic file(s). This method is a stub to be + Renderer of the thumnail file(s). This method is a stub to be refined (e.g. in xowf). @param upload_info dict containing the "file_object" and "file_name"