AttachTable
Contents
PURPOSE
This macro generates a table of the attachments to a page.
KEYWORD PARAMETERS
page=string |
Display the attachment table for an alternate page, default is this page |
syntax=1 |
display the wiki syntax to display the attachment in text |
closed=0 |
display the table in a closed/unexpanded form, the default value can be controled wiki wide with the cfg value attach_table_compact |
readonly=0 |
force the table to be displayed in readonly mode, dont display the delete option |
EXAMPLE
[[AttachTable]] [[AttachTable(page=FrontPage,syntax=0)]] [[AttachTable(readonly=1,closed=1,syntax=1)]]
screenshot
Installation
place AttachTable.py in the plugin/macro dir.
theme
the theme py file needs to be updated to add icon definitions to the icons table, there are two type of icons to define
- set for the table controlls
- these three icons are required and are used for the open/close action on the table, and one icon for the case where there are no attachments and an empty control image is used Example:
# AttachTable toggle controls 'table-null': ("null table control image", "table-null.png", 16, 16), 'table-close': ("close table control image", "table-close.png", 16, 16), 'table-open': ("open table control image", "table-open.png", 16, 16),
- these three icons are required and are used for the open/close action on the table, and one icon for the case where there are no attachments and an empty control image is used Example:
- Config filetypes
The only one that is required is the unknown entry, this is used for all files that there was no specific extention match found in the icons config. the other entrys are for specifying the image to use for specific file exentions. Example:
# AttachTable file mime types 'unknown': ("unknown type", "filetype-unkown.png", 32, 32), '.py': ("python file", "filetype-py.png", 32, 32), '.c': ("c source file", "filetype-c.png", 32, 32), '.cpp': ("cpp source file", "filetype-cpp.png", 32, 32), '.cxx': ("cpp source file", "filetype-cpp.png", 32, 32), '.tex': ("tex source file", "filetype-tex.png", 32, 32), '.rpm': ("rpm file", "filetype-rpm.png", 32, 32), '.doc': ("Word file", "filetype-doc.png", 32, 32), '.xls': ("Excel file", "filetype-xls.png", 32, 32), '.mov': ("mov file", "filetype-mov.png", 32, 32), '.ttf': ("ttf file", "filetype-ttf.png", 32, 32), '.txt': ("txt file", "filetype-doc.png", 32, 32), '.pdf': ("pdf file", "filetype-pdf.png", 32, 32), '.php': ("php file", "filetype-php.png", 32, 32),
css
here is the css that we are using, merge this into common.css for the theme(s)
images
the images used in the configuration above need to be placed in the theme/img dir.
here are the three images that I use for table control
the other images i used are copys from the kde crystalsvg set /usr/share/icons/crystalsvg/32x32/
Discussion
Where in the theme py file are the changes you describe supposed to go?
We have overiden the default values of icons that is defined in theme/__init__.py in the theme that we are using so that is where I added the new entrys, you can eather copy the default values from __init__.py into your theme(s) and add the new entrys there or add them to the end of __init__.py
-- ErickMartin 2006-11-29 17:53:04
I am not understanding were do I put the config filetypes
Index: MoinMoin/theme/__init__.py =================================================================== --- MoinMoin/theme/__init__.py (revision 243) +++ MoinMoin/theme/__init__.py (working copy) @@ -64,6 +64,27 @@ # search forms 'searchbutton': ("[?]", "moin-search.png", 12, 12), 'interwiki': ("[%(wikitag)s]", "moin-inter.png", 16, 16), + # file mime types + '.py': ("python file", "filetype-py.png", 32, 32), + '.c': ("c source file", "filetype-c.png", 32, 32), + '.cpp': ("cpp source file", "filetype-cpp.png", 32, 32), + '.cxx': ("cpp source file", "filetype-cpp.png", 32, 32), + '.tex': ("tex source file", "filetype-tex.png", 32, 32), + '.rpm': ("rpm file", "filetype-rpm.png", 32, 32), + '.doc': ("Word file", "filetype-doc.png", 32, 32), + # '.ppt': ("Power Point file", "filetype-ppt.png", 32, 32), + '.xls': ("Excel file", "filetype-xls.png", 32, 32), + # '.zip': ("zip file", "filetype-zip.png", 32, 32), + # '.bmp': ("bmp file", "filetype-bmp.png", 32, 32), + '.mov': ("mov file", "filetype-mov.png", 32, 32), + '.ttf': ("ttf file", "filetype-ttf.png", 32, 32), + '.txt': ("txt file", "filetype-doc.png", 32, 32), + '.pdf': ("pdf file", "filetype-pdf.png", 32, 32), + '.php': ("php file", "filetype-php.png", 32, 32), + 'unknown': ("unknown type", "filetype-unkown.png", 32, 32), + 'table-null': ("null table control image", "null.png", 16, 16), + 'table-close': ("close table control image", "table-close.png", 16, 16), + 'table-open': ("open table control image", "table-open.png", 16, 16), } del _
Errata
However to get it work correctly on my system I had to apply some changes:
- Change to theme/_init_.py: The filename in the dict-entry above for "unknown files" has to be "filetype-unknown.png" and not "filetype-unkown.png"
Change to AttachTable.py: theme.img_url does onyl take filenames and not dict-entries. I thus changed line 92,93 to
table_closed_file_name = 'table-open.png' table_open_file_name = 'table-close.png'
-- OliverSiemoneit 2006-12-17 12:06:35
Changed Version
This is really a wonderful macro! Many thanks for that Erick! On TaskPlanner you can now find a changed version of AttachTable which allows to preview images, has some built-in mimetype-classes and has also full multi language support. I also based TaskTable heavily on your macro. You macro was a big, big help for that! Thanks! -- OliverSiemoneit 2006-12-26 17:18:54