[%# Parameters We Are Expecting: ============================ action: The URL for the the 'action button', will implicitly append dir and file url params. dirs_only: Display the 'action button' only for directories or symlinks to directories. files_only: Display the 'action button' only for file items (the inverse of dirs_only). content: The HTML contents of the action button item (name and icon) %] [% SET dir = RAW_FORM.item('dir'); SET homedir = CPANEL.homedir; SET homedir = homedir.replace('/$', ''); # Normalize dir SET dir = '/' _ dir.split('/').grep('[^/\s]').join('/') _ '/'; SET dir = dir.replace('//','/') %] [% PROCESS "_assets/mime_types_icon_classes.tt" #Get the MimeTypesIconClasses hash %] [% SET list_files_response = execute ("Fileman", "list_files", { dir => dir, include_mime => 1, show_hidden => 1 }); IF list_files_response.status != 0; SET list_of_files = list_files_response.data; SET up_one = dir.split('/').slice(0,-2).join('/'); %]
[%locale.maketext('Home') %] [% IF dir != '/' %] [%locale.maketext('Up One Level') %] [% END %]
[% locale.maketext('Current Directory:') %]  / [% # Split up the sub dirs so we can link to each piece SET target_dir = ''; FOREACH sub_dir IN dir.remove('^/').split('/'); SET target_dir = target_dir _ sub_dir _ '/' %] [% sub_dir.html() %] / [% END %]
[% IF list_of_files.size > 0 %] [% FOREACH entry IN list_of_files %] [% IF entry.type == 'dir' || ( entry.type == 'link' and entry.rawmimename.match('directory') ) %] [% ELSE %] [% END %] [% END %] [% ELSE %] [% END %]
[% locale.maketext('Name') %] [% locale.maketext('Size') %] [% locale.maketext('Actions') %]
[%# Deliberately removed whitespace to prevent annoying underlines in the wrong spot from a:hover css %] [%- IF entry.type == 'link' -%][%- END -%][%entry.file.html()%] [% UNLESS files_only %] [% INCLUDE button %] [% END %] [%entry.file.html()%] [% entry.humansize.html() %] [% UNLESS dirs_only %] [% INCLUDE button %] [% END %]
[% locale.maketext('No files or folders are available.') %]
[% ELSE %] [% FOREACH message IN list_files_response.errors %] [% END %] [% END %] [% BLOCK button %]
[% END %]