apache / openmeetings

Mirror of Apache Openmeetings
Other
639 stars 261 forks source link

OPENMEETINGS-2273 Room File Tree Details panel - Add header - Toggle download button enable rather then display and fix download of original for PDF and documents #63

Closed sebawagner closed 4 years ago

sebawagner commented 4 years ago

Fixes OPENMEETINGS-2273

New default view of the panel without selecting anything: image

When selecting a file it enables the download button: image

This won't fix the dropdown next to the button:

solomax commented 4 years ago

BTW Your download button looks weird :( It looks like this for me:

Screenshot from 2020-04-18 09-35-56

i.e. the caret occupies much less space

sebawagner commented 4 years ago

I think you need to flush your browser cache or rebuild. What browser are you using?

On Sat, 18 Apr 2020 at 14:37, Maxim Solodovnik notifications@github.com wrote:

BTW Your download button looks weird :( It looks like this for me:

[image: Screenshot from 2020-04-18 09-35-56] https://user-images.githubusercontent.com/3870591/79626143-135a1f80-8158-11ea-9fb3-1b3f69f106da.png

i.e. the caret occupies much less space

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/apache/openmeetings/pull/63#issuecomment-615542484, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHJ2QGCRQFBNAGWF6K3RSTRNEG7PANCNFSM4MLDHQUA .

-- Sebastian Wagner https://twitter.com/#!/dead_lock seba.wagner@gmail.com

solomax commented 4 years ago

It looks like this in all my browsers (Chrome, Chromium, FF) Also ca be checked here https://getbootstrap.com/docs/4.4/components/dropdowns/

sebawagner commented 4 years ago

@solomax I added a comment and demo of the issue in: https://issues.apache.org/jira/browse/OPENMEETINGS-2273

But I'm not sure on how to fix the issue anymore, since like you mentioned: We don't know the original file extension since user can rename file. So how would it work at all ?

solomax commented 4 years ago

Hello @sebawagner,

As i noted before:

Due to above

The logic was following: File folder for IMAGE contains

  1. original image
  2. ** image as PNG (will be the same if image uploaded was PNG) So to get Original we should list files and filter PNG :))

File folder for PRESENTATION contains

  1. original documment
  2. PDF (if document wasn't PDF)
  3. list of pages as PNG So to get Original we should list files and filter PNG and PDF :))

The above method has obvious limitation: it will not work if original file was PDF

so to fix download issue for PDF I would do the following:

    public final File getOriginal() {
        File f = getFile(null);
        if (f != null) {
            File p = f.getParentFile();
            if (p != null && p.exists()) {
                File original = null;
                File[] ff = p.listFiles(new OriginalFilter());
                if (ff != null && ff.length > 0) {
                    original = ff[0];
                }
                if (original == null) {
                    if (Type.PRESENTATION == type) {
                        f = getFile(EXTENSION_PDF);
                    }
                } else {
                    f = original;
                }
            }
        }
        return f;
    }

i.e. if type is PRESENTATION and original wasn't found - get PDF

does it make sense?

sebawagner commented 4 years ago

Please see https://github.com/apache/openmeetings/pull/64 Lets split this discussion on UI vs download into separated PRs. And if I manage to add some Unit tests would also be good.