what is missing to achieve automatic file size insertion into body text
Dylan Jay <djay-n0pU0XVUApFWk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.web.zope.plone.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, We have a requirement which doesn't seem to have any good solutions. That is when a user inserts a link to a pdf or word document the document size and type will get automatically inserted next to it (in a theme dependent format). However it doesn't work for the version of Plone we are using (4.3) and it's approach isn't so good. It replaces the file link dialog in tinymce so any upgrades to tinymce will mean this plugin breaks. Also it inserts the size during editing so changing the file will make the size inaccurate. So the problem I'm faced with is how to solve this in another way nicely? There is some solutions I thought of: 1. diazo framgments (https://pypi.python.org/pypi/collective.tinymceplugins.advfilelinks) I was thinking using this might be a good usecase for Martins Diazo fragments idea https://github.com/plone/plone.app.theming/pull/10 You would define a rule that replaced all links that end in .pdf with a fragment. The fragment is ZPT so could easily take the link, lookup the object and write a link with size etc, perhaps using the catalog to lookup the size for speed. Fragments isn't really designed to take in arguments however. You'd have to do something tricky with XSLT I think <replace css:theme="a.mypdflink" css:content="a.myreplacementlink" href="/@@theme-fragment/linkswithsize?docurl=(*somehow_insert_url_here)" /> Perhaps fragments needs to have passed in the content html for which it is replacing? 2. My own custom render layer. That doesn't seem like a good idea. I'd rather solve this generally. 3. Something like tinymcetiles. ie the editor can insert a link as a tile instead of using a different button on tinymce. Not great UX because you now have two different ways to insert a link. 4. Using tinymce tiles but you get to insert a size tile next to the link, rather than instead of the link. This means the user has to do two actions to insert a link + the tile plugin would somehow have to be able to read the html around where it was inserted. 5. build in the concept of inserting filesize and mimetypes into links as part of the UID link processing in the core? at least in a way that diazo could transform them to make them pretty. For example in the url e.g. /@@download/myfile/size/234/application/pdf/mypdf.pdf or in the data arguments of the A tag. As you can see, so far no way is very clean. Any ideas? Dylan Jay --- www.pretagov.com - Secure SaaS for Government hosted locally. P: +61-2-9955-2830 +44-87-0392-7071 | linkedin.com/in/djay75 ------------------------------------------------------------------------------ Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk