hello
the request was to
1. show a xls table attached to the node as a file like an inline image
2. in the case that there are more than one attachment with the same name (newer versions) then show the last one
Therefor some modification to the source code were done:
* for point 2 (see above) the function _inline_fileobj was modified so that the last entry is selected
* for point 1 the function _inline_decide_img_tag was superseded by the new function _inline_decide_inline_tag which returns some find of file type.
for each file type there must exist a function creation the according output. In this case the new function is theme_inline_xls
This is my absolute first try to struggle the the drupal code, so the attached code is absolutely alpha!
There are hard coded pathes, mime type, character transformation ...
The code must be worded on!
I would be lucky if somebody more experienced than me in handling drupal code will have a look at the code.
Regards
schildi
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | inline.module-excel_0.patch | 6.25 KB | schildi |
| #2 | inline.module-excel.patch | 2.56 KB | schildi |
| inline.module.tgz | 4.81 KB | schildi |
Comments
Comment #1
sunThanks for contributing!
Could you please attach a patch instead? See http://drupal.org/diffandpatch for further information on how to create patches. Never attach compressed archives, please.
Comment #2
schildi commentedOK, here is my simple patch.
When testing the code please (install the tools if necessary and) adjust the pathes in theme_inline_xls and have a look at the coded mime types in function _inline_decide_inline_tag.
The code currently does not contain a check for the correct pathes since for some (unknown) reason the functions is_executabel always returns FALSE.
This is my first try to contribute code to the drupal project, so please feel free to tell me your thoughts.
Regards
Schildi
Comment #3
sunYou should read and adhere to the Drupal Coding Standards and might additionally install Coder module if you want to contribute usable code for Drupal and contributed modules.
Some hints:
Comment #4
schildi commentedAttached you find a new patch for displaying excel (xls) tables.
ad 1) settings are now done at the right place
ad 2) upload module DOES support files with the same filename.
When you upload a (modified) file a second time this will result in e.g.
So the array_reverse() in _inline_fileobj() is needed.
ad 3)
I don't really know what you mean. I tried to change the existing function as less as possible
and implement the new functionalities in a new function.
ad 4)
Solved, I had to adjust the settings for the virtual host.
Regards
Schildi
Please again feel free to comment the code
Comment #5
schildi commentedTo see the results of applying "inline" to excel files see e.g.
http://archiv.bgv-rhein-berg.de/node/2382
Regards
Schildi
Comment #6
dirkson commentedDoesn't patch cleanly against v6 of inline
Comment #7
schildi commentedThe module (D6 version) is evolving quickly. Possibly the patch will bot be necessary in future.
So I am not planning to port the patch to D6.
Did you have success in applying the patch ?