/usr/share/pyshared/MoinMoin/macro/ShowSmileys.py is in python-moinmoin 1.9.3-1ubuntu2.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # -*- coding: iso-8859-1 -*-
"""
MoinMoin - List all defined smileys
<<ShowSmileys>> will display a table of all the available smileys.
Based on code by Nick Trout <trout@users.sf.net>
@copyright: 2003 Juergen Hermann <jh@web.de>
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin import config
from MoinMoin.util.dataset import TupleDataset, Column
from MoinMoin.widget.browser import DataBrowserWidget
COLUMNS = 4
Dependencies = ['user'] # different users have different themes and different user prefs (text/gfx)
def macro_ShowSmileys(macro):
_ = macro.request.getText
fmt = macro.formatter
# create data description
data = TupleDataset()
data.columns = []
for dummy in range(COLUMNS):
data.columns.extend([
Column('markup', label=_('Markup')),
Column('image', label=_('Display'), align='center'),
Column('', label=''),
])
data.columns[-1].hidden = 1
# iterate over smileys, in groups of size COLUMNS
smileys = config.smileys
for idx in range(0, len(smileys), COLUMNS):
row = []
for off in range(COLUMNS):
if idx+off < len(smileys):
markup = smileys[idx+off]
row.extend([fmt.code(1) + fmt.text(markup) + fmt.code(0), fmt.smiley(markup), '', ])
else:
row.extend([' '] * 3)
data.addRow(tuple(row))
# display table
if data:
browser = DataBrowserWidget(macro.request)
browser.setData(data)
return browser.render(method="GET")
return ''
|