Discussion:
new to theme modifying and need help
greg
2005-04-17 12:54:44 UTC
Permalink
I've been using the sincor4moin theme I got from the ThemeMarket and I
want to make what seems like a very small modificaiton. Right now
there is a panel in the left side bar. It has the "Edit", "Get Info",
and the More Actions pull down. I want to add a "Attachments (#)"
where # is the number of attachments.

It looks like this panel is formed in Theme.editbar. Just working by
example, I added.

add(link(request, quotedname + '?action=AttachFile',
_('Attachments', formatted=False)))

So far, so good. I have "Attachments" text in the sidebar. Now how
do I get the number of attachments? I thought I could use a method of
the page objects to get a list of attachments or something similar,
but couldn't find anything promising. Looking around the source code,
II found text like "%s(attach_count)s" that looks promising but I
haven't figured out quite how to use it. Do I pass this to a function
that decodes it or does it go in the return of editbar and get decoded
downstream?

Any help is appreciated. Thanks for MoinMoin. So far it looks great
-- clean with hidden and exensible power. Well it's python.

Thanks,
Greg

BTW, in case it's not the convention for themes, the context for the
snippet above is:

_ = self.request.getText
link = wikiutil.link_tag
links = []
add = links.append
items = '\n'.join(['<li>%s</li>' % item for item in links if item != '']
html = u'<ul class="editbar">\n%s\n</ul>\n' % items
return html


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
greg
2005-04-19 04:28:32 UTC
Permalink
OK. I came up with a solution using what was in action.AttachFile.
Not sure it's the best but it works.

pagename = d['page_name'] # is this right?
attach_dir = getAttachDir(request, pagename)
files = []
if os.path.isdir(attach_dir):
files = os.listdir(attach_dir)

add(link(request, quotedname + '?action=AttachFile',
_('Attachments', formatted=False) + " (%i)" % len(files)))

I also learned something new about python string interpolation. Doh.
Post by greg
I've been using the sincor4moin theme I got from the ThemeMarket and I
want to make what seems like a very small modificaiton. Right now
there is a panel in the left side bar. It has the "Edit", "Get Info",
and the More Actions pull down. I want to add a "Attachments (#)"
where # is the number of attachments.
It looks like this panel is formed in Theme.editbar. Just working by
example, I added.
add(link(request, quotedname + '?action=AttachFile',
_('Attachments', formatted=False)))
So far, so good. I have "Attachments" text in the sidebar. Now how
do I get the number of attachments? I thought I could use a method of
the page objects to get a list of attachments or something similar,
but couldn't find anything promising. Looking around the source code,
II found text like "%s(attach_count)s" that looks promising but I
haven't figured out quite how to use it. Do I pass this to a function
that decodes it or does it go in the return of editbar and get decoded
downstream?
Any help is appreciated. Thanks for MoinMoin. So far it looks great
-- clean with hidden and exensible power. Well it's python.
Thanks,
Greg
BTW, in case it's not the convention for themes, the context for the
_ = self.request.getText
link = wikiutil.link_tag
links = []
add = links.append
items = '\n'.join(['<li>%s</li>' % item for item in links if item != '']
html = u'<ul class="editbar">\n%s\n</ul>\n' % items
return html
-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
Loading...