From 4873aa944fd4aeaa4e4e613a46090820e0223ca9 Mon Sep 17 00:00:00 2001 From: Marco Dickert Date: Thu, 6 Jul 2017 14:02:50 +0200 Subject: [PATCH] * use template for filetable generation * don't use inline js * fixed some bugs related to the code refactoring --- ifm.php | 375 +++++++++++++++++---------- src/ifm.js | 243 ++++++++++------- src/main.php | 61 ++--- src/style.css | 7 +- src/templates/app.html | 8 +- src/templates/filetable.html | 52 ++++ src/templates/modal.extractfile.html | 4 +- 7 files changed, 466 insertions(+), 284 deletions(-) create mode 100644 src/templates/filetable.html diff --git a/ifm.php b/ifm.php index 4e6c51b..942b5a9 100644 --- a/ifm.php +++ b/ifm.php @@ -357,15 +357,18 @@ class IFM { font-size: 14pt; } -#filetable tr td:nth-child(5) { +#filetable td:nth-child(5), #filetable th:nth-child(5) { text-align: center; } -#filetable tr td:nth-child(6) { +#filetable td:nth-child(6), #filetable th:nth-child(6) { text-align: center; } #filetable tr td:last-child { text-align: right; } +#filetable td:last-child a:hover { + text-decoration: none; +} a { cursor: pointer !important; } @@ -455,17 +458,20 @@ this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+th '; @@ -1674,16 +1720,16 @@ ifm.init( "ifm" ); case "createDir": $this->createDir( $_REQUEST["dir"], $_REQUEST["dirname"] ); break; case "saveFile": $this->saveFile( $_REQUEST ); break; case "getContent": $this->getContent( $_REQUEST ); break; - case "deleteFile": $this->deleteFile( $_REQUEST ); break; - case "renameFile": $this->renameFile( $_REQUEST ); break; - case "downloadFile": $this->downloadFile( $_REQUEST ); break; - case "extractFile": $this->extractFile( $_REQUEST ); break; - case "uploadFile": $this->uploadFile( $_REQUEST ); break; + case "delete": $this->deleteFile( $_REQUEST ); break; + case "rename": $this->renameFile( $_REQUEST ); break; + case "download": $this->downloadFile( $_REQUEST ); break; + case "extract": $this->extractFile( $_REQUEST ); break; + case "upload": $this->uploadFile( $_REQUEST ); break; case "copyMove": $this->copyMove( $_REQUEST ); break; case "changePermissions": $this->changePermissions( $_REQUEST ); break; case "zipnload": $this->zipnload( $_REQUEST); break; case "remoteUpload": $this->remoteUpload( $_REQUEST ); break; - case "deleteMultipleFiles": $this->deleteMultipleFiles( $_REQUEST ); break; + case "multidelete": $this->deleteMultipleFiles( $_REQUEST ); break; case "getFolderTree": echo json_encode( array_merge( array( 0 => array( "text" => "/ [root]", "nodes" => array(), "dataAttributes" => array( "path" => realpath( $this->config['root_dir'] ) ) ) ), $this->getFolderTreeRecursive( $this->config['root_dir'] ) ) ); break; @@ -1719,47 +1765,39 @@ ifm.init( "ifm" ); api functions */ - private function getFiles($dir) { - // SECURITY FUNCTION (check that we don't operate on a higher level that the script itself) - $dir=$this->getValidDir($dir); - // now we change in our target directory - $this->chDirIfNecessary($dir); - // unset our file and directory arrays - unset($files); unset($dirs); $files = array(); $dirs = array(); - // so lets loop over our directory - if ($handle = opendir(".")) { - while (false !== ($result = readdir($handle))) { // this awesome statement is the correct way to loop over a directory :) - if( $result == basename( $_SERVER['SCRIPT_NAME'] ) && $this->getScriptRoot() == getcwd() ) { } // we don't want to see the script itself - elseif( ( $result == ".htaccess" || $result==".htpasswd" ) && $this->config['showhtdocs'] != 1 ) {} // check if we are granted to see .ht-docs - elseif( $result == "." ) {} // the folder itself will also be invisible - elseif( $result != ".." && substr( $result, 0, 1 ) == "." && $this->config['showhiddenfiles'] != 1 ) {} // eventually hide hidden files, if we should not see them - elseif( ! @is_readable( $result ) ) {} - else { // thats are the files we should see + private function getFiles( $dir ) { + $dir = $this->getValidDir( $dir ); + $this->chDirIfNecessary( $dir ); + + unset( $files ); unset( $dirs ); $files = array(); $dirs = array(); + + if( $handle = opendir( "." ) ) { + while( false !== ( $result = readdir( $handle ) ) ) { + if( $result == basename( $_SERVER['SCRIPT_NAME'] ) && $this->getScriptRoot() == getcwd() ) { } + elseif( ( $result == ".htaccess" || $result==".htpasswd" ) && $this->config['showhtdocs'] != 1 ) {} + elseif( $result == "." ) {} + elseif( $result != ".." && substr( $result, 0, 1 ) == "." && $this->config['showhiddenfiles'] != 1 ) {} + else { $item = array(); - $i = 0; $item["name"] = $result; - $i++; if( is_dir($result) ) { $item["type"] = "dir"; - } else { - $item["type"] = "file"; - } - if( is_dir( $result ) ) { if( $result == ".." ) $item["icon"] = "icon icon-up-open"; else $item["icon"] = "icon icon-folder-empty"; } else { + $item["type"] = "file"; $type = substr( strrchr( $result, "." ), 1 ); $item["icon"] = $this->getTypeIcon( $type ); } if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $result ) ); } if( $this->config['showfilesize'] == 1 ) { - $item["filesize"] = filesize( $result ); - if( $item["filesize"] > 1073741824 ) $item["filesize"] = round( ( $item["filesize"]/1073741824 ), 2 ) . " GB"; - elseif($item["filesize"]>1048576)$item["filesize"] = round( ( $item["filesize"]/1048576 ), 2 ) . " MB"; - elseif($item["filesize"]>1024)$item["filesize"] = round( ( $item["filesize"]/1024 ), 2 ) . " KB"; - else $item["filesize"] = $item["filesize"] . " Byte"; + $item["size"] = filesize( $result ); + if( $item["size"] > 1073741824 ) $item["size"] = round( ( $item["size"]/1073741824 ), 2 ) . " GB"; + elseif($item["size"]>1048576)$item["size"] = round( ( $item["size"]/1048576 ), 2 ) . " MB"; + elseif($item["size"]>1024)$item["size"] = round( ( $item["size"]/1024 ), 2 ) . " KB"; + else $item["size"] = $item["size"] . " Byte"; } if( $this->config['showpermissions'] > 0 ) { if( $this->config['showpermissions'] == 1 ) $item["fileperms"] = substr( decoct( fileperms( $result ) ), -3 ); @@ -2557,17 +2595,15 @@ ifm.init( "ifm" ); size {{/config.showfilesize}} {{#config.showpermissions}} - permissions + permissions {{/config.showpermissions}} {{#config.showowner}} - owner + owner {{/config.showowner}} {{#config.showgroup}} - group + group {{/config.showgroup}} - {{#ftbuttons}} - {{/ftbuttons}} @@ -2578,6 +2614,61 @@ ifm.init( "ifm" ); +f00bar; + $templates['filetable'] = <<<'f00bar' + +{{#items}} + + + + + {{linkname}} + + + + {{#download.allowed}} +
+ + + +
+ + + + {{/download.allowed}} + + {{#config.showlastmodified}} + {{lastmodified}} + {{/config.showlastmodified}} + {{#config.showfilesize}} + {{size}} + {{/config.showfilesize}} + {{#config.showpermissions}} + + + + {{/config.showpermissions}} + {{#config.showowner}} + + {{owner}} + + {{/config.showowner}} + {{#config.showgroup}} + + {{group}} + + {{/config.showgroup}} + + {{#button}} + + + + {{/button}} + + +{{/items}} + + f00bar; $templates['file'] = <<<'f00bar'
@@ -2690,8 +2781,8 @@ f00bar; ./
- - ./{{targetDirSuggestion}} + + ./{{destination}}
diff --git a/src/ifm.js b/src/ifm.js index e51460e..4e7ae24 100644 --- a/src/ifm.js +++ b/src/ifm.js @@ -1,16 +1,19 @@ /** * IFM constructor + * + * @param object params - object with some configuration values, currently you only can set the api url */ function IFM( params ) { var self = this; // reference to ourself, because "this" does not work within callbacks // set the backend for the application + params = params || {}; self.api = params.api || window.location.pathname; this.editor = null; // global ace editor this.fileChanged = false; // flag for check if file was changed already this.currentDir = ""; // this is the global variable for the current directory; it is used for AJAX requests - this.rootElement = undefined; + this.rootElement = ""; /** * Shows a bootstrap modal @@ -76,89 +79,129 @@ function IFM( params ) { * @param object data - object with items */ this.rebuildFileTable = function( data ) { - var newTBody = $(document.createElement('tbody')); - for( var i=0; i < data.length; i++ ) { - var newRow = '"'; - } else { - newRow += ' onclick="$(\'#d_'+guid+'\').submit();"'; - } - } else { - newRow += ' onclick="ifm.changeDirectory(\''+data[i].name+'\')"'; + data.forEach( function( item ) { + item.guid = self.generateGuid(); + item.linkname = ( item.name == ".." ) ? "[ up ]" : item.name; + item.download = {}; + item.download.name = ( item.name == ".." ) ? "." : item.name; + item.download.allowed = self.config.download; + item.download.currentDir = self.currentDir; + if( ! self.config.chmod ) + item.readonly = "readonly"; + if( self.config.edit || self.config.rename || self.config.delete || self.config.extract || self.config.copymove ) { + item.ftbuttons = true; + item.button = []; } - newRow += '> ' + ( data[i].name == '..' ? '[ up ]' : data[i].name ) + ''; - if( ( data[i].type != "dir" && self.config.download == 1 ) || ( data[i].type == "dir" && self.config.zipnload == 1 ) ) { - newRow += ''; - newRow += ''; - newRow += ''; - newRow += ''; - newRow += ''; + if( item.type == "dir" ) { + item.download.action = "zipnload"; + item.download.icon = "icon icon-download-cloud"; + item.rowclasses = "isDir"; } else { - newRow += ''; + item.download.action = "download"; + item.download.icon = "icon icon-download"; + if( item.icon.indexOf( 'file-image' ) !== -1 ) + item.tooltip = 'data-toggle="tooltip" title=""'; + if( item.name.toLowerCase().substr(-4) == ".zip" ) + item.eaction = "extract"; + else + item.eaction = "edit"; + if( self.config.edit && item.name.toLowerCase().substr(-4) != ".zip" ) + item.button.push({ + action: "edit", + icon: "icon icon-pencil", + title: "edit" + }); + else + item.button.push({ + action: "extract", + icon: "icon icon-archive", + title: "extract" + }); } - // last-modified - if( self.config.showlastmodified > 0 ) - newRow += '' + data[i].lastmodified + ''; - // size - if( self.config.showfilesize > 0 ) - newRow += '' + data[i].filesize + ''; - // permissions - if( self.config.showpermissions > 0 ) - newRow += ''; - // owner - if( self.config.showowner > 0 ) - newRow += ''+data[i].owner+''; - // group - if( self.config.showgroup > 0 ) - newRow += '' + data[i].group + ''; - // actions - if( self.inArray( 1, [self.config.edit, self.config.rename, self.config.delete, self.config.extract, self.config.copymove] ) ) { - newRow += ''; - if( data[i].name.toLowerCase().substr(-4) == ".zip" && self.config.extract == 1 ) { - newRow += ''; - } else if( self.config.edit == 1 && data[i].type != "dir" ) { - newRow += ''; - } - if( data[i].name != ".." && data[i].name != "." ) { - if( self.config.copymove == 1 ) { - newRow += ''; - } - if( self.config.rename == 1 ) - newRow += ''; - if( self.config.delete == 1 ) - newRow += ''; - } - newRow += ''; - } else { - newRow += ''; - } - newTBody.append( newRow ); - } - $("#filetable tbody").remove(); - $("#filetable").append( newTBody ); - $('.clickable-row').click(function(event) { - if( event.ctrlKey ) { - $(this).toggleClass( 'selectedItem' ); + if( ! self.inArray( item.name, [".", ".."] ) ) { + if( self.config.copymove ) + item.button.push({ + action: "copymove", + icon: "icon icon-folder-open-empty", + title: "copy/move" + }); + if( self.config.rename ) + item.button.push({ + action: "rename", + icon: "icon icon-terminal", + title: "rename" + }); + if( self.config.delete ) + item.button.push({ + action: "delete", + icon: "icon icon-trash", + title: "delete" + }); } }); - $('a[data-toggle="tooltip"]').tooltip({ + var newTBody = Mustache.render( self.templates.filetable, { items: data, config: self.config } ); + $( "#filetable tbody" ).remove(); + $( "#filetable" ).append( $(newTBody) ); + $( '.clickable-row' ).click( function( event ) { + if( event.ctrlKey ) { + $( this ).toggleClass( 'selectedItem' ); + } + }); + $( 'a[data-toggle="tooltip"]' ).tooltip({ animated: 'fade', placement: 'right', html: true }); + $( 'a.ifmitem' ).each( function() { + if( $(this).data( "type" ) == "dir" ) { + $(this).on( 'click', function( e ) { + e.stopPropagation(); + self.changeDirectory( $(this).parent().parent().data( 'filename' ) ); + return false; + }); + } else { + if( self.config.isDocroot ) + $(this).attr( "href", self.pathCombine( self.currentDir, $(this).parent().parent().data( 'filename' ) ) ); + else + $(this).on( 'click', function() { + $( '#d_' + this.id ).submit(); + return false; + }); + } + }); + $( 'a[name="start_download"]' ).on( 'click', function(e) { + e.stopPropagation(); + $( '#d_' + $(this).data( 'guid' ) ).submit(); + return false; + }); + $( 'input[name="newpermissions"]' ).on( 'keypress', function( e ) { + if( e.key == "Enter" ) { + e.stopPropagation(); + self.changePermissions( $( this ).data( 'filename' ), $( this ).val() ); + return false; + } + }); + $( 'a[name^="do-"]' ).on( 'click', function() { + var action = this.name.substr( this.name.indexOf( '-' ) + 1 ); + switch( action ) { + case "rename": + self.showRenameFileDialog( $(this).data( 'name' ) ); + break; + case "extract": + self.showExtractFileDialog( $(this).data( 'name' ) ); + break; + case "edit": + self.editFile( $(this).data( 'name' ) ); + break; + case "delete": + self.showDeleteFileDialog( $(this).data( 'name' ) ); + break; + case "copymove": + self.showCopyMoveDialog( $(this).data( 'name' ) ); + break; + } + }); + }; /** @@ -370,7 +413,7 @@ function IFM( params ) { url: self.api, type: "POST", data: ({ - api: "deleteFile", + api: "delete", dir: self.currentDir, filename: filename }), @@ -415,7 +458,7 @@ function IFM( params ) { url: ifm.api, type: "POST", data: ({ - api: "renameFile", + api: "rename", dir: ifm.currentDir, filename: filename, newname: newname @@ -436,7 +479,7 @@ function IFM( params ) { * * @params string name - name of the file */ - this.showCopyMoveDialog = function( filename ) { + this.showCopyMoveDialog = function( name ) { self.showModal( self.templates.copymove ); $.ajax({ url: self.api, @@ -509,11 +552,11 @@ function IFM( params ) { * @param string name - name of the file */ this.showExtractFileDialog = function( filename ) { - var targetDirSuggestion = ""; - if( filename.lastIndexOf( "." ) > 1 ) - targetDirSuggestion = filename.substr( 0, name.length - 4 ); + var targetDirSuggestion = ''; + if( filename.lastIndexOf( '.' ) > 1 ) + targetDirSuggestion = filename.substr( 0, filename.lastIndexOf( '.' ) ); else targetDirSuggestion = filename; - self.showModal( Mustache.render( self.templates.extractfile, { filename: filename, targetDirSuggestion: targetDirSuggestion } ) ); + self.showModal( Mustache.render( self.templates.extractfile, { filename: filename, destination: targetDirSuggestion } ) ); var form = $('#formExtractFile'); form.find('#buttonExtract').on( 'click', function() { var t = form.find('input[name=extractTargetLocation]:checked').val(); @@ -542,7 +585,7 @@ function IFM( params ) { url: self.api, type: "POST", data: { - api: "extractFile", + api: "extract", dir: self.currentDir, filename: filename, targetdir: destination @@ -583,7 +626,7 @@ function IFM( params ) { var ufile = document.getElementById( 'ufile' ).files[0]; var data = new FormData(); var newfilename = $("#formUploadFile input[name^=newfilename]").val(); - data.append('api', 'uploadFile'); + data.append('api', 'upload'); data.append('dir', self.currentDir); data.append('file', ufile); data.append('newfilename', newfilename); @@ -619,27 +662,26 @@ function IFM( params ) { * @params object e - event object * @params string name - name of the file */ - this.changePermissions = function(e, name) { - if(e.keyCode == '13') - $.ajax({ + this.changePermissions = function( filename, newperms) { + $.ajax({ url: self.api, type: "POST", data: ({ api: "changePermissions", dir: self.currentDir, filename: filename, - chmod: e.target.value + chmod: newperms }), dataType: "json", - success: function(data){ - if(data.status == "OK") { - self.showMessage("Permissions successfully changed.", "s"); - self.refreshFileTable(); - } - else { - self.showMessage("Permissions could not be changed: "+data.message, "e"); - } - }, + success: function( data ){ + if( data.status == "OK" ) { + self.showMessage( "Permissions successfully changed.", "s" ); + self.refreshFileTable(); + } + else { + self.showMessage( "Permissions could not be changed: "+data.message, "e"); + } + }, error: function() { self.showMessage("General error occured.", "e"); } }); }; @@ -757,7 +799,7 @@ function IFM( params ) { url: self.api, type: "POST", data: ({ - api: "deleteMultipleFiles", + api: "multidelete", dir: self.currentDir, filenames: filenames }), @@ -888,7 +930,7 @@ function IFM( params ) { scrollOffset = el.offset().top - ( window.innerHeight || document.documentElement.clientHeight ) + el.height() + 15; else scrollOffset = el.offset().top - 55; - $('html, body').animate( { scrollTop: scrollOffset }, 500 ); + $('html, body').animate( { scrollTop: scrollOffset }, 200 ); } }; if( param.jquery ) { @@ -980,6 +1022,7 @@ function IFM( params ) { return; } + console.log( "pressed "+e.key ); switch( e.key ) { case 'Delete': if( self.config.delete ) { @@ -1186,5 +1229,5 @@ function IFM( params ) { }; } -var ifm = new IFM({}); +var ifm = new IFM(); ifm.init( "ifm" ); diff --git a/src/main.php b/src/main.php index 2fc4147..2c3fbed 100644 --- a/src/main.php +++ b/src/main.php @@ -111,16 +111,16 @@ class IFM { case "createDir": $this->createDir( $_REQUEST["dir"], $_REQUEST["dirname"] ); break; case "saveFile": $this->saveFile( $_REQUEST ); break; case "getContent": $this->getContent( $_REQUEST ); break; - case "deleteFile": $this->deleteFile( $_REQUEST ); break; - case "renameFile": $this->renameFile( $_REQUEST ); break; - case "downloadFile": $this->downloadFile( $_REQUEST ); break; - case "extractFile": $this->extractFile( $_REQUEST ); break; - case "uploadFile": $this->uploadFile( $_REQUEST ); break; + case "delete": $this->deleteFile( $_REQUEST ); break; + case "rename": $this->renameFile( $_REQUEST ); break; + case "download": $this->downloadFile( $_REQUEST ); break; + case "extract": $this->extractFile( $_REQUEST ); break; + case "upload": $this->uploadFile( $_REQUEST ); break; case "copyMove": $this->copyMove( $_REQUEST ); break; case "changePermissions": $this->changePermissions( $_REQUEST ); break; case "zipnload": $this->zipnload( $_REQUEST); break; case "remoteUpload": $this->remoteUpload( $_REQUEST ); break; - case "deleteMultipleFiles": $this->deleteMultipleFiles( $_REQUEST ); break; + case "multidelete": $this->deleteMultipleFiles( $_REQUEST ); break; case "getFolderTree": echo json_encode( array_merge( array( 0 => array( "text" => "/ [root]", "nodes" => array(), "dataAttributes" => array( "path" => realpath( $this->config['root_dir'] ) ) ) ), $this->getFolderTreeRecursive( $this->config['root_dir'] ) ) ); break; @@ -156,47 +156,39 @@ class IFM { api functions */ - private function getFiles($dir) { - // SECURITY FUNCTION (check that we don't operate on a higher level that the script itself) - $dir=$this->getValidDir($dir); - // now we change in our target directory - $this->chDirIfNecessary($dir); - // unset our file and directory arrays - unset($files); unset($dirs); $files = array(); $dirs = array(); - // so lets loop over our directory - if ($handle = opendir(".")) { - while (false !== ($result = readdir($handle))) { // this awesome statement is the correct way to loop over a directory :) - if( $result == basename( $_SERVER['SCRIPT_NAME'] ) && $this->getScriptRoot() == getcwd() ) { } // we don't want to see the script itself - elseif( ( $result == ".htaccess" || $result==".htpasswd" ) && $this->config['showhtdocs'] != 1 ) {} // check if we are granted to see .ht-docs - elseif( $result == "." ) {} // the folder itself will also be invisible - elseif( $result != ".." && substr( $result, 0, 1 ) == "." && $this->config['showhiddenfiles'] != 1 ) {} // eventually hide hidden files, if we should not see them - elseif( ! @is_readable( $result ) ) {} - else { // thats are the files we should see + private function getFiles( $dir ) { + $dir = $this->getValidDir( $dir ); + $this->chDirIfNecessary( $dir ); + + unset( $files ); unset( $dirs ); $files = array(); $dirs = array(); + + if( $handle = opendir( "." ) ) { + while( false !== ( $result = readdir( $handle ) ) ) { + if( $result == basename( $_SERVER['SCRIPT_NAME'] ) && $this->getScriptRoot() == getcwd() ) { } + elseif( ( $result == ".htaccess" || $result==".htpasswd" ) && $this->config['showhtdocs'] != 1 ) {} + elseif( $result == "." ) {} + elseif( $result != ".." && substr( $result, 0, 1 ) == "." && $this->config['showhiddenfiles'] != 1 ) {} + else { $item = array(); - $i = 0; $item["name"] = $result; - $i++; if( is_dir($result) ) { $item["type"] = "dir"; - } else { - $item["type"] = "file"; - } - if( is_dir( $result ) ) { if( $result == ".." ) $item["icon"] = "icon icon-up-open"; else $item["icon"] = "icon icon-folder-empty"; } else { + $item["type"] = "file"; $type = substr( strrchr( $result, "." ), 1 ); $item["icon"] = $this->getTypeIcon( $type ); } if( $this->config['showlastmodified'] == 1 ) { $item["lastmodified"] = date( "d.m.Y, G:i e", filemtime( $result ) ); } if( $this->config['showfilesize'] == 1 ) { - $item["filesize"] = filesize( $result ); - if( $item["filesize"] > 1073741824 ) $item["filesize"] = round( ( $item["filesize"]/1073741824 ), 2 ) . " GB"; - elseif($item["filesize"]>1048576)$item["filesize"] = round( ( $item["filesize"]/1048576 ), 2 ) . " MB"; - elseif($item["filesize"]>1024)$item["filesize"] = round( ( $item["filesize"]/1024 ), 2 ) . " KB"; - else $item["filesize"] = $item["filesize"] . " Byte"; + $item["size"] = filesize( $result ); + if( $item["size"] > 1073741824 ) $item["size"] = round( ( $item["size"]/1073741824 ), 2 ) . " GB"; + elseif($item["size"]>1048576)$item["size"] = round( ( $item["size"]/1048576 ), 2 ) . " MB"; + elseif($item["size"]>1024)$item["size"] = round( ( $item["size"]/1024 ), 2 ) . " KB"; + else $item["size"] = $item["size"] . " Byte"; } if( $this->config['showpermissions'] > 0 ) { if( $this->config['showpermissions'] == 1 ) $item["fileperms"] = substr( decoct( fileperms( $result ) ), -3 ); @@ -931,6 +923,9 @@ class IFM { $templates = array(); $templates['app'] = <<<'f00bar' @@@src/templates/app.html@@@ +f00bar; + $templates['filetable'] = <<<'f00bar' +@@@src/templates/filetable.html@@@ f00bar; $templates['file'] = <<<'f00bar' @@@src/templates/modal.file.html@@@ diff --git a/src/style.css b/src/style.css index e21c05b..964dfeb 100644 --- a/src/style.css +++ b/src/style.css @@ -7,15 +7,18 @@ body { font-size: 14pt; } -#filetable tr td:nth-child(5) { +#filetable td:nth-child(5), #filetable th:nth-child(5) { text-align: center; } -#filetable tr td:nth-child(6) { +#filetable td:nth-child(6), #filetable th:nth-child(6) { text-align: center; } #filetable tr td:last-child { text-align: right; } +#filetable td:last-child a:hover { + text-decoration: none; +} a { cursor: pointer !important; } diff --git a/src/templates/app.html b/src/templates/app.html index b6bc414..3a60080 100644 --- a/src/templates/app.html +++ b/src/templates/app.html @@ -62,17 +62,15 @@ size {{/config.showfilesize}} {{#config.showpermissions}} - permissions + permissions {{/config.showpermissions}} {{#config.showowner}} - owner + owner {{/config.showowner}} {{#config.showgroup}} - group + group {{/config.showgroup}} - {{#ftbuttons}} - {{/ftbuttons}} diff --git a/src/templates/filetable.html b/src/templates/filetable.html new file mode 100644 index 0000000..1f8eb29 --- /dev/null +++ b/src/templates/filetable.html @@ -0,0 +1,52 @@ + +{{#items}} + + + + + {{linkname}} + + + + {{#download.allowed}} +
+ + + +
+ + + + {{/download.allowed}} + + {{#config.showlastmodified}} + {{lastmodified}} + {{/config.showlastmodified}} + {{#config.showfilesize}} + {{size}} + {{/config.showfilesize}} + {{#config.showpermissions}} + + + + {{/config.showpermissions}} + {{#config.showowner}} + + {{owner}} + + {{/config.showowner}} + {{#config.showgroup}} + + {{group}} + + {{/config.showgroup}} + + {{#button}} + + + + {{/button}} + + +{{/items}} + diff --git a/src/templates/modal.extractfile.html b/src/templates/modal.extractfile.html index 85ece38..5f96373 100644 --- a/src/templates/modal.extractfile.html +++ b/src/templates/modal.extractfile.html @@ -7,8 +7,8 @@ ./
- - ./{{targetDirSuggestion}} + + ./{{destination}}