File manager for Webmin

344 posts / 0 new
Last post
Fri, 08/07/2015 - 09:16
stn

Just was uploading 20+ files. Allowed to drag and drop all in time.Nice!

An then 20+ error messages "File already exists". What the heck! since when existing file became obstacle to overwrite newer over?

Fri, 08/07/2015 - 13:28 (Reply to #152)
RealGecko

Since common sense became popular. For me it is better to see that file already exists and then go and see why the heck it is already there, than to understand after a few minutes that the file I needed was replaced with the outdated one and it cannot be restored...oh oohh.

Fri, 08/07/2015 - 23:32 (Reply to #153)
stn

Sure, agree in full. Warning that file exists is absolutely must. But warning not error. Otherwise I just can't proceed with my work.

Theoretically I can delete the file and upload it again. But in my particular case there were 20+ from thousand of all similarly named files. Not a pleasant work to review all them again. And secondly I was acting as root on behalf of an ordinary user. If the files were overwritten, their properties were preserved, new files would be created chown root.

Yes all is doable. but why I should do that boring work, not a computer which was created for that.

Sat, 08/08/2015 - 08:40 (Reply to #154)
marciano

I think a desirable way would be that OSX uses: Warning: Replace/Make a Copy/Skip/Cancel and an 'Apply to all' checkbox. I don't know if it possible but it would be great. Thanks M

Sun, 08/09/2015 - 01:57 (Reply to #155)
RealGecko

Many people ask me to AJAXify most common operations to avoid full page reloads. I'm already thinking about, this will make your scenario real :)

Sun, 08/09/2015 - 13:32 (Reply to #156)
marciano

Ajax is a great tool to only load that what changes in a page

Sun, 08/09/2015 - 23:39 (Reply to #157)
RealGecko

Currently index.cgi sends multipart/form-data to upload.cgi, that accepts and manages it in one pass of the script. So if we add some more logic to upload.cgi like trying to ask user what to do with this file or that file, it will increase script complexity and will reduce user friendliness. AJAX way will allow to do two way communication between currently open page and upload.cgi that will allow to handle situations that require user intervention without actually breaking process.

There are also some cool libraries that make great help, like this one https://blueimp.github.io/jQuery-File-Upload/. But for now I decided not to increase Filemin complexity by adding third party libraries and do as much as possible using Webmin core.

Sun, 08/09/2015 - 01:46 (Reply to #158)
RealGecko

Cause any computer is just a bunch of wires and circuitry that worth nothing without programs it executes. And programs are created by programmers. And any program creation is dictated by user requests. So if you think that program you use lacks some features come and ask like any other people do, instead of coming and saying - "Hey! What the heck??? Why is this piece of ... ssssoftware does not work as I expected????"

Sun, 08/09/2015 - 13:35 (Reply to #159)
marciano

Agree

Fri, 08/07/2015 - 15:40
marciano

From Webmin/Install Module

Downloading https://github.com/Real-Gecko/filemin/blob/master/distrib/filemin-0.9.5.... ..
.. download complete.

Failed to install module from https://github.com/Real-Gecko/filemin/blob/master/distrib/filemin-0.9.5.... : Not a valid module file : gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now

Sun, 08/09/2015 - 01:49 (Reply to #161)
RealGecko

Navigate to the link you provided and see that it is not the direct download link but an HTML page on GitHub. There you'll see two links: one says "View Raw", other one says just "Raw". Both of them are valid. That's the way GitHub deals with binaries.

Thu, 08/13/2015 - 08:59 (Reply to #162)
Ilia
Ilia's picture

Going to the link you provided, right mouse click on RAW and Copy Link Address. That's the link you need.

Ilia

Thu, 08/13/2015 - 10:56
Ilia
Ilia's picture

Thanks for Filemin - it's awesome!

I think there is no reason to disable sorting on size column. It can be implemented the way it's done in Authentic Theme. I made it working by making custom extension for dataTables (based on Webmin data used), which took me hours to figure this out! It works in 99% cases. Now you can test in in Disk Quotas module and add it to Filemin! ;)

1 . Open your filemin-lib.pl

and on line 290, replace

print ""columnDefs": [ { "orderable": false, "targets": [0, 1, 4] }, ],";

With:

print ""columnDefs": [ { "orderable": false, "targets": [0, 4], "sType": "file-size", "targets": [1] }, ],";

Now when using Authentic Theme, the sorting files by size will work!

2 . Another improvement is to enable dataTable save state mode. dataTable uses browser's localStorage to do it in favor of dated cookies. For example, if user has chosen to sort table by name or pagination number, you WOULD obviously WANT to save this selection, when user opens another page, right?

So add this to your dataTable init: print ""bStateSave": true,";

3 . The following can be added to some place in your js codes. (I tested it with dataTables.bootstrap.js and it worked)

A . Let user navigate with arrows (left/right) when trying to do pagination:

$(document).on('keydown', function (event) {
var keycode = event.keyCode ? event.keyCode : event.which;
if (!$('input').is(':focus') && !$('select').is(':focus') && !$('textarea').is(':focus')) {
if (keycode === 39) {
$('.paginate_button.next').trigger('click');
}
if (keycode === 37) {
$('.paginate_button.previous').trigger('click');
}
}
});

B . Hide paginations when there is nothing to paginate. Add the following on init, let's say below bPaginate:

__

print " "fnDrawCallback": function(oSettings) {
    console.log(oSettings._iDisplayLength);
        if (\(\$('table > tbody > tr:visible').length - 1) >= oSettings._iDisplayLength) {
            \$('.dataTables_paginate').show();
        } else {
            \$('.dataTables_paginate').hide();
        }
    },";

This is it for now. It will make already cool Filemin File Manager even cooler! ;)

Tell me how it works for you, folks!?

Ilia

Thu, 08/13/2015 - 11:14 (Reply to #164)
Ilia
Ilia's picture

B . Hide paginations requires a bit of work. It fails a bit sometimes..

Ilia

Thu, 08/13/2015 - 12:28 (Reply to #165)
Ilia
Ilia's picture

Oops. :) fix for the first part.

  1. This:

print ""columnDefs": [ { "orderable": false, "targets": [0, 4], "sType": "file-size", "targets": [1] }, ],";

Has to be:

print ""columnDefs": [ { "orderable": false, "targets": [0, 1] }, { "type": "file-size", "targets": [4] } ],";

There will be more, fixes, I think.

Ilia

Thu, 08/13/2015 - 12:55
Ilia
Ilia's picture

Another fix for fnDrawCallback function:

print " "fnDrawCallback": function(oSettings) {
        if (oSettings.fnRecordsTotal() <= oSettings._iDisplayLength) {
            \$('.dataTables_paginate').hide();
        } else {
            \$('.dataTables_paginate').show();
        }
    },";

Ilia

Thu, 08/13/2015 - 13:22
Ilia
Ilia's picture

Another point as we don't need to store search results on page reload and we WANT the search field be automatically focused:

Add it below the on that is above:

print " "initComplete": function() {
    \$('div.dataTables_filter input').val('').trigger('keyup');
    \$('div.dataTables_filter input').focus();
    },";

Ilia

Thu, 08/13/2015 - 14:16
Ilia
Ilia's picture

Sorry for so many posts. :D

I have finally fixed the sorting function for sizes that gave sometimes unaccurate results. Now it's all cool!

In the new version of Authentic Theme It will be fixed and with proposed above pieces of codes it will LITERALLY sort files in Filemin (and all other stuff across Webmin) - PERFECTLY.

In case you're impatient you can test it by finding the following in Authentic Theme package.min.js:

Find:

$.fn.extend(jQuery.fn.dataTableExt.oSort,{"file-size-pre":function(b){z=b.match(/<[^>]*>([\s\S]*?)<.*>/);z&&z[1]?(y=z[1]):(y=b);x=y.match(/(\+|-)?((\d+(\.\d+)?)|(\.\d+))/);x&&(x=x[0]);return(b.match(/TB/i)||b.match(/ТБ/i))?(x*1024*1024*1024*1024):(b.match(/GB/i)||b.match(/ГБ/i))?(x*1024*1024*1024):(b.match(/MB/i)||b.match(/МБ/i))?(x*1024*1024):(b.match(/kB/i)||b.match(/КБ/i))?(x*1024):1},"file-size-asc":function(d,c){return((d<c)?-1:((d>c)?1:0))},"file-size-desc":function(d,c){return((d<c)?1:((d>c)?-1:0))}});

Replace with:

$.fn.extend(jQuery.fn.dataTableExt.oSort,{"file-size-pre":function(t){return z=t.match(/<[^>]*>([\s\S]*?)<.*>/),y=z&&z[1]?z[1]:t,x=y.match(/(\+|-)?((\d+(\.\d+)?)|(\.\d+))/),x&&(x=x[0]),x=t.match(/Byte/i)||t.match(/Bytes/i)||t.match(/Байт/i)?1*x:t.match(/kB/i)||t.match(/КБ/i)?1024*x:t.match(/MB/i)||t.match(/МБ/i)?1024*x*1024:t.match(/GB/i)||t.match(/ГБ/i)?1024*x*1024*1024:t.match(/TB/i)||t.match(/ТБ/i)?1024*x*1024*1024*1024:1,x},"file-size-asc":function(t,i){return i>t?-1:t>i?1:0},"file-size-desc":function(t,i){return i>t?1:t>i?-1:0}});

Original, fixed and working code:

$.fn.extend(jQuery.fn.dataTableExt.oSort, {
"file-size-pre": function (a) {
z = a.match(/<[^>]*>([\s\S]*?)<.*>/);
z && z[1] ? (y = z[1]) : (y = a);
x = y.match(/(\+|-)?((\d+(\.\d+)?)|(\.\d+))/);
x && (x = x[0]);
if (a.match(/Byte/i) || a.match(/Bytes/i) || a.match(/Байт/i)) {
x = (x * 1);
} else if (a.match(/kB/i) || a.match(/КБ/i)) {
x = (x * 1024);
} else if (a.match(/MB/i) || a.match(/МБ/i)) {
x = (x * 1024 * 1024);
} else if (a.match(/GB/i) || a.match(/ГБ/i)) {
x = (x * 1024 * 1024 * 1024);
} else if (a.match(/TB/i) || a.match(/ТБ/i)) {
x = (x * 1024 * 1024 * 1024 * 1024);
} else {
x = 1;
}
return x;
},
"file-size-asc": function (a, b) {
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"file-size-desc": function (a, b) {
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
});

Ilia

Thu, 08/13/2015 - 14:37
Ilia
Ilia's picture

@RealGeako.

First of all, you should also exclude Actions from sorting. :)

Besides, I wouldn't recommend using Perl part for generating table header for Filemin, because later, you use hard-coded init settings on columnDefs, referring to the column, by it's number which is always DIFFERENT based on user settings.

So there are two options:

  1. Hiding/Showing columns using dataTables API (that will not break things like now)

  2. Using Perl to count and later supply the correct numbers in columnDefs. (0 , 1, 3 - to exclude from sorting and for file-size is 4 - this is default and it works ok, if user doesn't change anything in settings) - well you must make those numbers dynamic.

Ilia

Thu, 08/13/2015 - 15:18 (Reply to #170)
Ilia
Ilia's picture

Small fix to make it work. No it doesn't matter what user settings are it will not fail. Now, for example, if user disables size column the whole thing will not work, if you do proper size sorting options set.

Put it to init_datatables, at the very top:

    my ($a, $b, $c);
    $a = '0, 1, 3';
    $b = '4';
    $c = '';
    if ($userconfig{'columns'} =~ /type/) {
        $a = '0, 1, 4';
        $b = '5';
    }
    if ($userconfig{'columns'} =~ /size/) {
        $c = '{ "type": "file-size", "targets": [' . $b . '] },';
    }

And part for print columnDefs:

print ""columnDefs": [ { "orderable": false, "targets": [$a] }, $c ],";

It will exclude columns properly based on different user settings and will make sorting files by size work correctly.

Sorting by Last Modification time still not working but this we will fix later.

Please make those change in a commit.

P.S. Please add SELinux labels support.

Regards, Ilia

Ilia

Thu, 08/13/2015 - 15:23 (Reply to #171)
Ilia
Ilia's picture

..and all together to save people's time:

For filemin-lib.pl:

sub init_datatables {

    my ($a, $b, $c);
    $a = '0, 1, 3';
    $b = '4';
    $c = '';
    if ($userconfig{'columns'} =~ /type/) {
        $a = '0, 1, 4';
        $b = '5';
    }
    if ($userconfig{'columns'} =~ /size/) {
        $c = '{ "type": "file-size", "targets": [' . $b . '] },';
    }

    if($userconfig{'disable_pagination'}) {
        $bPaginate = 'false';
    } else {
        $bPaginate = 'true';
    }
print "<script>";
print "\$( document ).ready(function() {";
print "\$.fn.dataTableExt.sErrMode = 'throw';";
print "\$('#list_form > table').dataTable({";
print ""order": [],";
print ""aaSorting": [],";
print ""bDestroy": true,";
print ""bPaginate": $bPaginate,";
print " "fnDrawCallback": function(oSettings) {
        if (oSettings.fnRecordsTotal() <= oSettings._iDisplayLength) {
            \$('.dataTables_paginate').hide();
        } else {
            \$('.dataTables_paginate').show();
        }
    },";
print " "initComplete": function() {
    \$('div.dataTables_filter input').val('').trigger('keyup');
    \$('div.dataTables_filter input').focus();
    },";
print ""bInfo": false,";
print ""destroy": true,";
print ""oLanguage": {";
print ""sSearch": " "";
print "},";
print ""columnDefs": [ { "orderable": false, "targets": [$a] }, $c ],";
print ""bStateSave": true,";
print ""iDisplayLength": 50,";
print "});";
print "\$("form").on('click', 'div.popover', function() {";
print "\$(this).prev('input').popover('hide');";
print "});";
print "});";
print "</script>";
}

For main.js:

$(document).on('keydown', function (event) {
var keycode = event.keyCode ? event.keyCode : event.which;
if (!$('input').is(':focus') && !$('select').is(':focus') && !$('textarea').is(':focus') && !$('body').find('.application-modal').length) {
if (keycode === 39) {
$('.paginate_button.next').trigger('click');
}
if (keycode === 37) {
$('.paginate_button.previous').trigger('click');
}
}
});

Enjoy.

Ilia

Sun, 08/23/2015 - 15:13
Ilia
Ilia's picture

Dear friends, hi! ;)

I have made an enormous attempt (over 33 hours of work), to be available for all Authentic Theme 15+ users, on its birthday release (1 year :) ), to make Filemin fully AJAXed (run all functions in background, without page reload).

It will bring you absolutely new experience and will make your Filemin faster from 3 to 5 times.

Please leave your feedbacks and comments or found bugs here (https://github.com/Real-Gecko/filemin/issues/48)

Best regards, Ilia

Ilia

Wed, 08/26/2015 - 19:18
RealGecko

Version 0.9.6 is out. Urgent update is advised. Cause of https://github.com/Real-Gecko/filemin/issues/54

Full list of changes:

  • Fixed `Undefined subroutine &filemin::ceil Caused on some systems by not including POSIX package in filemin-lib.pl.
  • Major Authentic interface improvement by Ilia Rostovtsev
    1. Working sorting files by size (with next Authentic Theme - perfectly, now just alright). This fix will also prevent fatal code breaks despite of user settings
    2. Store user chose on columns sorting upon page refresh
    3. Hide paginations when there is nothing to paginate.
    4. Let user navigate with arrows (left/right) when trying to do pagination
  • Fixing conflict with Authentic Theme codeMirror By Ilia.
  • Code cleanup and security tightening by Jamie Cameron
  • Add ACL options to allowing running as a specific user, thanks Jamie :)
  • WARNING: work as root is now DEFAULT behavior. IF YOU GRANTED FILEMIN ACCESS TO ANY USERS NOT SUPPOSED TO WORK AS ROOT - GO AND CHECK ACL!!!

    46 fixed:
  • Module is now installable from Usermin. When running in Usermin, access is always as the connected user.

    52 fixed:
  • Working as non UNIX user is now possible. By Jamie Cameron.

    54 fixed:
  • Pasting a directory either by copy or cut pasted not the directory, but it's content.
Thu, 08/27/2015 - 09:03
jvieille

I tried https://github.com/Real-Gecko/filemin/raw/master/distrib/webmin-filemin_...

But it did not work.

How to install this? Thanks

Thu, 08/27/2015 - 09:26 (Reply to #175)
RealGecko

How did you try to install? dpkg?

Thu, 08/27/2015 - 09:29
jvieille

From webmin

Thu, 08/27/2015 - 09:34 (Reply to #177)
RealGecko

The link you provided is deb package for installation with dpkg. https://github.com/Real-Gecko/filemin/raw/master/distrib/filemin-0.9.6.l... Here is Linux wbm for installation from Webmin.

Thu, 08/27/2015 - 09:43
jvieille

Thanks, this one works. However, I cannot find this link by browsing on Github.

Thu, 08/27/2015 - 23:25 (Reply to #179)
RealGecko

They can be found in module readme.

Mon, 08/31/2015 - 07:43
marciano

Hello RG,

I ask you to display files and directories quantity. Thanks, M

Mon, 08/31/2015 - 23:23 (Reply to #181)
RealGecko

Number of entries?

Please fill new issue here https://github.com/Real-Gecko/filemin/issues

So I will not forget to do it for the next release.

Mon, 08/31/2015 - 09:52
monsieurQ

Following instructions from the current Readme, using this URL through webmin interface (Centos 6):

https://github.com/Real-Gecko/filemin/raw/master/distrib/filemin-0.9.6.l...

I get :

Failed to install package : Not a valid compressed or gzipped RPM file

Mon, 08/31/2015 - 11:59 (Reply to #183)
andreychek

Howdy,

That does look like the correct URL.

Can you describe the process you're using to install that into Webmin?

-Eric

Mon, 08/31/2015 - 23:21 (Reply to #184)
RealGecko

This file is intended to be installed from Webmin interface.

I currently do not provide RPM packages, cause it needs operational CentOS or RedHat that I do not have.

My dev box is Debian that's why I have deb package as a bonus.

Tue, 09/01/2015 - 05:47 (Reply to #185)
monsieurQ

@RealGecko @Andrey

Ok installing as a RPM by URL was the issue. downloading the file and uploading as a local file solved the issue.

Many thanks

Tue, 09/01/2015 - 10:09
BlueStar

I had to install it by using the .tar.gz link under the Releases tab on GitHub. I would go to Webmin > Webmin Configuration > Webmin Modules > Installation and then I tried "From ftp or http URL", "From local file", and "From uploaded file" but would get the errors below (again, same error using all three methods of installing).

"Failed to install module from /webmin-filemin_0.9.6_all.deb : Not a valid module file : tar: This does not look like a tar archive tar: Skipping to next header tar: Exiting with failure status due to previous errors"

and

"Failed to install module from /filemin-0.9.6.linux.wbm.gz : Not a valid module file : gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now"

There might be some issue with the 0.9.6 .wbm.gz and .deb versions because using the .tar.gz under Releases works fine.

But there is still a problem beyond that, but I'm not sure who this is attributed to. Using the Authentic theme, once Filemin's been successfully installed, I go into Filemin, click a folder, but nothing happens. It just greys out and hangs. Switching to the default theme does alleviate the issue, so I'm not sure which is causing the issue. Is it not working well with Authentic or vice versa? Despite Authentic's stated increased support for it, even after v15.51, Filemin isn't working right for me.

Tue, 09/01/2015 - 10:40 (Reply to #187)
Ilia
Ilia's picture

What browser are you using? Did you clear cache after installing theme, restarted Webmin and browser?

It was tested and it just works.

Ilia

Tue, 09/01/2015 - 10:52 (Reply to #188)
BlueStar

Using Chrome, Firefox, IE, and Edge. Cleared cache. Restarted Webmin service. Nothing's changed.

Tue, 09/01/2015 - 13:46 (Reply to #189)
Ilia
Ilia's picture

Hi there! Well I even restarted to Windows 10 to test it in all mentioned browsers - all works fine! Even ancient Opera version 15 and IE 11 and capricious Edge goes fine with Filemin + AJAX as well.

Please try to make sure that everything is alright on your side. There would be many people complains if it was the real bug.

In case you can't figure this out, please make video screenshot, with opened console (preferably in Chrome), so I could understand what is happening.

Try reinstalling the Theme and Filemin, making sure that you are really using the latest version. Also check that you have updated your Webmin to the latest.

Ilia

Tue, 09/01/2015 - 13:54
Ilia
Ilia's picture

..and you're getting this error when installing the module as you feed to Webmin not the destination URL but GitHub page.

To get the link, when you on that page which you were trying to paste to Webmin, you need to right click on RAW and copy the link URL, then use that direct link.

https://github.com/qooob/authentic-theme/raw/master/.build/authentic-the...

https://github.com/Real-Gecko/filemin/raw/master/distrib/webmin-filemin_... https://github.com/Real-Gecko/filemin/raw/master/distrib/filemin-0.9.6.l... https://github.com/Real-Gecko/filemin/raw/master/distrib/filemin-0.9.6.f...

Ilia

Tue, 09/01/2015 - 14:40 (Reply to #191)
BlueStar

That worked. Thank you so much! I'm not sure if it was an Authentic upgrade gone wrong (I've had it installed since v8, so maybe somewhere along the lines?). Nevertheless, re-adding Authentic with the provided link, then using the second Filemin link worked (first brought up an error). But, all is working now and I'm very happy. Thank you!

Tue, 09/01/2015 - 15:16 (Reply to #192)
Ilia
Ilia's picture

Good to know! :) You're welcome.

Ilia

Tue, 09/01/2015 - 17:20
deanski79

Howdy,

I am not sure if I am missing something, but when logged with user (domain owner) I can't find the filemin. Is there any option in webmin/virtualmin to enable filemin for domain owners ?

Regards, Dean Iliev

Wed, 09/02/2015 - 01:14 (Reply to #194)
RealGecko

Yes, you need to grant access to the module in Webmin configuration. It will be in Webmin - Other - Filemin File Manager. Sometimes domain owners do not see Webmin menu while in Virtualmin. Will try to make link to module appear in Virtualmin menu in next release.

Wed, 09/02/2015 - 23:41 (Reply to #195)
deanski79

Thank you , I found how to manage this. Alas, I couldn't find an automatic way to do this. When I allow some user to access filemin module by default he accesses filesystem as root. This can be changed of course, but it is not very convenient to do this manually for every user.

Great file manager, I am waiting the next version! Keep up the good work!

Regards, Dean Iliev

Wed, 09/02/2015 - 23:57 (Reply to #196)
RealGecko

You can create Webmin group, setup module ACL, and make every new user part of that group. This will apply desired settings to all of them. Note that individ user settings prevail over group settings.

Fri, 09/04/2015 - 10:14
scaramanga

Hi, thanks for creating Filemin - I was getting really fed up with having to switch back to IE every time I wanted to move a file.

I have a number of files that I cannot move or copy with Filemin but I can with Webmin standard file manager.

The error message is:

[destination path] moving file failed with error: No such file or directory

Both the source and the destination are 777 and I have ownership of both. I am logging in to Webmin as a user with permission to run as root. I'm running Ubuntu 14.04

Thanks

Sat, 09/05/2015 - 09:17 (Reply to #198)
RealGecko

If you're using Authentic theme update it to the latest release, it had an issue with AJAXification of Filemin. If not then send me your .buffer file that is in your $HOME/.filemin directory. If you work as root it must be /root/.filemin/.buffer I presume.

Mon, 09/07/2015 - 04:40 (Reply to #199)
scaramanga

Thanks for the quick response.

I've tried with a number of different themes and Authentic is at latest version - all give the same error. It seems to be running as root as that's where the buffer file was.

Contents are nothing more than:

cut /data/temp Name of folder I'm attempting to move

That bit above is supposed to be on 3 lines, can't seem to make it format properly! There are no special characters in the folder name, just upper and lower case alpha.

Tue, 09/08/2015 - 04:11 (Reply to #200)
RealGecko

That's odd. I cannot reproduce the thing. What happens if you log in through ssh and try mv /data/temp/mycoolfolda /root/new/destination?

Pages

Topic locked