DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

File Listing

Our aim is to provide two SQL Frontends. One lists folders within a specified directory and allows a user-friendly access to these folders (linking to the other SQL Frontend). The second one shows files from the folder chosen in the first SQL Frontend. We furthermore want the files to be linked and provide a few other meta information.

We want to list all files within all fileadmin/template/ sub-directories (which are, namely, html, img, style, etc.).

Page and plugin structure

Page Plugin Dbal Handler Task
1 (outer) Directory List directories, link to page #2 with folder parameter
2 (inner) File List files within GET-submitted (tx_mhomsqlio_pi1[dir]) folder

Caution: As the second (the file) SQL Frontend needs to adapt to the _GET parameter, we have to set the file frontend page to be a no-cache page (the other one is fine).

Configuration of first (outer) directory-listing page

TypoScript of total configuration (you may configure it at any known place like TS, Flexform or Json):

plugin.tx_mhomsqlio {
    dbal {
            eType = Directory
            sDatabase = fileadmin
            sTable = template
    }
    data {
            bEdit = 1
            aField {
                    10 {
                            sColumn = name
                            eClass = TextShort
                            sHeadline = Directory
                    }
                    20 {
                            sColumn = tstamp_lastmodified
                            eClass = Timestamp
                            sFormat = Y-m-d H:i
                            sHeadline = Last Modification
                    }
            }
            eDisplay = Table
            bOnEditLinkToPage = 1
            sEditLink = ?id=2&tx_mhomsqlio_pi1[dir]=###name###
    }
}

Configuration of second (inner) file-listing page

TypoScript of second total configuration:

plugin.tx_mhomsqlio {
    dbal {
            eType = File
            sDatabase = fileadmin/template/
            aSubDirectoryParam {
                    sSource = GP
                    sField = tx_mhomsqlio_pi1[dir]
            }
    }
    data {
            eDisplay = Table
            aField {
                    10 {
                            sColumn = file
                            eClass = Link
                            sHeadline = Filename
                            sSort = text
                            sLink = file:###config:dbal/sTable######
                            bUseTypolinkFunction = 1
                            sTarget = _blank
                            sShow = ###
                            sTitle = Open file in new window
                    }
                    30 {
                            sColumn = size
                            eClass = TextShort
                            sHeadline = Filesize
                            sWrap = | bytes
                    }
                    40 {
                            sColumn = extension
                            eClass = TextShort
                            sHeadline = Ext.
                            bAutofilter = 1
                    }
                    50 {
                            sColumn = mime
                            eClass = TextShort
                            sHeadline = Mime-Type
                            bAutofilter = 1
                    }
                    60 {
                            sColumn = tstamp_creation
                            eClass = Timestamp
                            sHeadline = Creation
                            sFormat = Y-m-d
                    }
            }
    }
}