Show more of the file name

Bug #1046750 reported by Kristina Hoeppner
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Wishlist
Unassigned

Bug Description

https://mahara.org/interaction/forum/topic.php?id=4841

The file names are shortened too quickly when they are long and are not easily readable. A potential solution for showing more is proposed in the forum discussion, but maybe it can be made more flexible and depend on the width of the block?

Revision history for this message
Gordon McLeod (g-mcleod1) wrote :

Hi Kristina,

Just wondering if this might also be an approach to address the issue with filenames being displayed with video and other objects - https://bugs.launchpad.net/mahara/+bug/1034382

If the code suggested by Dirk could be tweaked with an 'if' statement that modified
 $child->title = str_shorten_text($child->title, 20); to
$child->title = str_shorten_text($child->title, 0); if the object type was an embedded block rather than a linked file

Of course I could be wildly wrong as these are two different object types (file links and blocks) - but the principle might be similar?

Thanks, Gordon.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hi Gordon,

We' d have to see what a developer says. My code reading ability doesn't extend to anything further. ;-) But I would say they might be separate things. They are definitely separate blocks, but if the name of the video file is also shortened too quickly, that should be fixed there as well. However, making it optional to display it is a different thing.

Cheers
Kristina

Changed in mahara:
status: New → Triaged
Revision history for this message
Dirk Meyer (dirkca68) wrote :

I am adding to change in another file also. In /artefact/file/blocktype/filedownload/theme/raw/filedonload.tpl we have a similar issue.
Changing
<h4><a href="{$file.downloadurl}" target="_blank">{$file.title|str_shorten_text:20}</a></h4>
to
<h4><a href="{$file.downloadurl}" target="_blank">{$file.title|str_shorten_text:64}</a></h4>

does a nice job showing the full file name,
Thnaks

Revision history for this message
Gordon McLeod (g-mcleod1) wrote :

Hi,
Just wondering if there's any progress in this filename display issue reaching core code?
In my new institution making custom tweaks to code is restricted so changes like this to enhance usability will only be implemented if they are changed in core.
Thanks, Gordon.

Revision history for this message
Kristina Hoeppner (kris-hoeppner) wrote :

Hello Gordon,

I'll flag this with the dev team.

Cheers
Kristina

Changed in mahara:
milestone: none → 1.8.0rc1
Revision history for this message
Aaron Wells (u-aaronw) wrote :

So, to be clear, we're talking about extending the file length displayed in:

- artefact/file/lib.php
- theme/raw/form/filelist.tpl
- artefact/file/blocktype/filedownload/theme/raw/filedownload.tpl

Is that right?

The truth is, Mahara puts no limit on the length of filenames uploaded. (They're stored in artefact.title, which is a binary text column, which in theory is more or less unlimited; in practice it's something like a couple billion characters.) So any length limit we pick is going to an arbitrary cutoff. I'm all for raising that arbitrary cutoff if people think it would make the site look better, though. :-D

There are a couple of other things we could do to help out with this as well:
 - put a "title" attribute (i.e. mouseover text) on the shortened name, which has the full name
 - use the CSS3 text-overflow attribute (supported in all modern browsers): http://caniuse.com/text-overflow
   - but the problem with text-overflow is that it puts ellipses at the END of the filename, which obscures the file suffix
 - find some JS library that will auto-expand/hide the text with ellipses in the middle (I didn't find one in a quick Google search)

Anyway, just let me know if I've identified all the places where the filename length should change, and I'll see about upstreaming it.

Cheers,
Aaron

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Actually, here's a JQuery plugin that promises to do it: https://github.com/tbasse/jquery-truncate

Revision history for this message
Dirk Meyer (dirkca68) wrote :

Hi Aaron,
please also add

-theme/raw/templates/collectionnav.tpl

When I change '30' to '60' I get the preferred results as per two screenshots.

Your solution sound much better but this could be a temporary workaround. If you are short on time, I could submit a bug fix.

Revision history for this message
Dirk Meyer (dirkca68) wrote :

after

Revision history for this message
Dirk Meyer (dirkca68) wrote :

I added a separate bug report for the collectionnav.tpl issue here https://bugs.launchpad.net/mahara/+bug/1203965

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Dirk submitted a patch for this: https://reviews.mahara.org/#/c/2368/

Revision history for this message
Aaron Wells (u-aaronw) wrote :

With Evonne's new theme changes, lengthy filenames wrap around quite nicely, so I no longer see any need to truncate them at all. I'll submit a patch to eliminate the limit on the display of filenames.

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Patch to eliminate file name length display restrictions: https://reviews.mahara.org/2376

Changed in mahara:
status: Triaged → In Progress
Revision history for this message
Aaron Wells (u-aaronw) wrote :

It's worth noting, to anyone following this bug, that there is some discussion about the merits of eliminating filename display lengths, in the review comments for https://reviews.mahara.org/2376

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/2376
Committed: http://gitorious.org/mahara/mahara/commit/7d46c586cead775efb903079a8f6e59964b4419b
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 7d46c586cead775efb903079a8f6e59964b4419b
Author: Aaron Wells <email address hidden>
Date: Wed Jul 24 14:14:07 2013 +1200

Show full filenames

Bug 1046750

Change-Id: I3baa2138d52f9ec415145d408dbe198ad302a777

Aaron Wells (u-aaronw)
Changed in mahara:
status: In Progress → Fix Committed
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.8rc1 → 1.8.0
Aaron Wells (u-aaronw)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.