Skip to content

An additional outputfilter that enhance file and image links informations in rich text

Notifications You must be signed in to change notification settings

PloneGov-IT/collective.outputfilters.enhancelinks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

collective.outputfilters.enhancelinks

https://travis-ci.org/PloneGov-IT/collective.outputfilters.enhancelinks.svg?branch=master

This product add a new outputfilter that generates additional informations for Tiny MCE's internal link.

It's a substitute of collective.tinymceplugins.advfilelinks, that doesn't work with Plone >= 4.3 because it uses Products.TinyMCE >= 1.3.

For every link that points to an internal content (file or image), in the rendered html will be added some new informations:

  • The mimetype icon before the link text
  • The mimetype and filesize after the link text
  • The url of a File points to the direct download

Install collective.outputfilters.enhancelinks by adding it to your buildout:

[buildout]

 ...

 eggs =
     collective.outputfilters.enhancelinks

and then run "bin/buildout".

It doesn't need to be installed.

This product is modular, so if you want to add this feature (or more features) to some custom content-types you only need to provide a new adapter for the ILinkEnhancerProvider interface:

<adapter
    for="your.package.interfaces.IYourContent"
    provides="collective.outputfilters.enhancelinks.interfaces.ILinkEnhancerProvider"
    factory=".adapters.YourContentEnhanceLink"
/>

Then provide the Python adapter code:

from collective.outputfilters.enhancelinks.adapters import BaseEnhanceLink

class YourContentEnhanceLink(BaseEnhanceLink):
    ...

There are 4 basic methods for a basic override:

def get_url_suffix(filename):
    """ Return additional suffix to append at the end of the url """

def get_icon_url(mime_infos):
    """ Return the correct mimetype icon url """

def get_extension(content_file, mime_infos):
    """ Return the filename extension"""

def get_formatted_size(content_file):
    """ Return a formatted file size """

If you want more mimetype icons (for example for OpenOffice documents), you could add and install collective.mtrsetup in your buildout.

This product has been tested on:

  • Plone 5.0
  • Plone 5.1
  • Plone 5.2

It works with Dexterity-based (plone.app.contenttypes) standard File and Image content-types. If you want support for Archetype-based content-types or Plone 4 compatibility, go with versions < 1.0.0.

The project is licensed under the GPLv2.

Developed with the support of:

All of them supports the PloneGov initiative.

This product was developed by RedTurtle Technology team.

RedTurtle Technology Site

About

An additional outputfilter that enhance file and image links informations in rich text

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages