Blog
Description
This is a simply Blog macro that utilises a javascript calendar and the Include macro to hack together a pseudo bliki (blog/wiki). The calendar is used to choose the entries to show, the number of visible entries is controlled by the select control "max entries". The button to the left of "max entries" allows you to toggle between the two modes "Show All" and "Show Published".
- "Show Published" only shows those days that contain entries up to the given "max entries", from the chosen calendar date.
- "Show All" Show all the dates, previous to the chosen calendar date, up to a maximum of "max entries". This is the mode you will need to use to enter new blog entries
Depedencies
Include - now part of the main distribution
Download & Release Notes
Download |
Release Version |
Moin Version |
Release Notes |
|
1.5 |
|
Installation
- Save the macro in your macro directory
Usage
<date> : in the format of yyyy-mm-dd
<showAll> : 1 or 0, where 1 shows all and 0 shows published
<entries> : the maximum visible number of entries
<maxEntries> : the maximum value that <entries> can be, this is used to restrict the web gui
<startDay> : The start Day for the calendar
- values : "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"
<date> : today
<showAll> : 0
<entries> : 5
<maxEntries>: 20
<startDay> : 'Mo'
[[Blog[<date>, <showAll>, <entries>, <maxEntries>
Blog(, 1, 7) - Shows all days, up to 7 days, from todays date.
Blog(2003-05-23, 0, 5) - Shows upto 5 published entries from the given date.
Blog( , , , 10) - Shows upto 5(default) published(default) entries from todays date(default), but does not allow the user to speficy max entries to be more than 10.
Blog( , , , , We) - Shows upto 5(default) published(default) entries from todays date(default), maxEntries(20) with start calendar day Wednesday.
Blog(2003-05-23, 0, 5, ,Sa) - Shows upto 5 published entries from the given date, with start calendar day Saturday
Discussion
- Q - How does one "enter" a new blog entry? I tried appliying the patches I saw on this site, and now I can see a calendar and I can select dates, but it is not clear how one can enter a new entry.
A - You press the button "Show All" and then by clicking on one of the dates you will create a new wiki page that contains your blog entry.
I had a problem with getting Blog macro to work right. My wiki is not set up as a server root, i.e., the address of the wiki is something like http://myhost/mywiki. The 'mywiki' part broke the calendar in Blog macro. Here is a patch of some haphazard changes that seems to make things work for me. Only the differences to the posted Blog.py file are showed (diff output).
114c114 < window.location.href = "/"+global.page+"?date="+global.date+"&entries="+global.entries+"&showAll="+global.showAll --- > window.location.href = global.page+"?date="+global.date+"&entries="+global.entries+"&showAll="+global.showAll 381c381 < thisPage = macro.formatter.page.page_name --- > thisPage = macro.formatter.page.url(macro.request) 396c396 < date = macro.form['date'].value --- > date = macro.form['date'][0] 405c405 < showAll = macro.form['showAll'].value --- > showAll = macro.form['showAll'][0] 413c413 < entries = macro.form['entries'].value --- > entries = macro.form['entries'][0] 438,439c438,439 < return ('<p><strong class="error">%s</strong></p>' %('Invalid entries "%s"!')) % (macro.form['beforeDate'].value) < entries = int(macro.form['entries'].value) --- > return ('<p><strong class="error">%s</strong></p>' %('Invalid entries "%s"!')) % (macro.form['beforeDate'][0]) > entries = int(macro.form['entries'][0]) 452c452 < return ('<p><strong class="error">%s</strong></p>' %('Invalid date "%s"!')) % (macro.form['date'].value) --- > return ('<p><strong class="error">%s</strong></p>' %('Invalid date "%s"!')) % (macro.form['date'][0]) 468c468 < ret += getShowEntered(macro, thisPage, year, month, day, entries, maxEntries) --- > ret += getShowEntered(macro, macro.formatter.page.page_name, year, month, day, entries, maxEntries) 485c485 < includeParams = '%s/BlogEntry-%d-%02d-%02d, "%d-%02d-%02d", 1' % (thisPage, year, month, day, year, month, day) --- > includeParams = '%s/BlogEntry-%d-%02d-%02d, "%d-%02d-%02d", 1' % (macro.formatter.page.page_name, year, month, day, year, month, day)
Here's a patch I applied to make Blog.py work with MoinMoin 1.3.1
503c503,504 < pages = wikiutil.getPageList(config.text_dir) --- > pages = macro.formatter.page.getPageList() > # pages = wikiutil.getPageList(config.text_dir)
Has anyone gotten this macro to work on MoinMoin version 1.3.5? I am running on windows with Python 2.3.4. I have applied the above patches to the file but still no luck. Thanks!
I have the same question about MoinMoin 1.5.2
I've adapt Blog.py to run with MoinMoin 1.3.5 yesterday Blog.py_adapt_to_1.3.5.diff
Greetings Carsten
An today I've published the Blog reworked for MoinMoin 1.5 Blog_MoinMoin1.5.py
Greeting Carsten
If your wiki isn't the server root (eg: http://myaddress/mywiki/FrontPage) this blog screws up. Applying the patch above (adopted for the 1.5 version) helps, but I cannot enter a new blog entry. Clicking on one of the dates remains the page untouched
This plugin doesnt work. the help materials are not useful. I got the following error. Looks like several people reported errors. please fix these or pl. stop distributing this macro so that more people dont waste their time. Thanks. KeyError
'entries'
If you want to report a bug, please save this page and attach it to your bug report.
- Show debugging information
- Report bug
Visit MoinMoin wiki
Traceback
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\MoinMoin\request.pyo in run (self=<MoinMoin.request.RequestStandAlone object>)
C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\MoinMoin\wikiaction.pyo in do_show (pagename=u'WebLog', request=<MoinMoin.request.RequestStandAlone object>)
C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\MoinMoin\Page.pyo in send_page (self=<MoinMoin.Page.Page instance>, request=<MoinMoin.request.RequestStandAlone object>, msg=, **keywords={'count_hit': 1})
C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\MoinMoin\Page.pyo in send_page_content (self=<MoinMoin.Page.Page instance>, request=<MoinMoin.request.RequestStandAlone object>, Parser=<class MoinMoin.parser.wiki.Parser>, body=u'Blog(2003-05-23, 0, 5, ,Sa)\n== PV Weblog ==\n...be nice if we have a common wiki markup language\n', format_args=, do_cache=1, **kw={'start_line': 0})
C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\MoinMoin\Page.pyo in execute (self=<MoinMoin.Page.Page instance>, request=<MoinMoin.request.RequestStandAlone object>, parser=<MoinMoin.parser.wiki.Parser instance>, code=<code object ? at 00DDD8A0, file "WebLog", line 2>)
C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\WebLog in ?
C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\MoinMoin\formatter\base.pyo in macro (self=<MoinMoin.formatter.text_html.Formatter instance>, macro_obj=<MoinMoin.wikimacro.Macro instance>, name=u'Blog', args=u'2003-05-23, 0, 5, ,Sa')
C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\MoinMoin\wikimacro.pyo in execute (self=<MoinMoin.wikimacro.Macro instance>, macro_name=u'Blog', args=u'2003-05-23, 0, 5, ,Sa')
C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\wiki\data\plugin\macro\Blog.py in execute (macro=<MoinMoin.wikimacro.Macro instance>, text=u'2003-05-23, 0, 5, ,Sa')
- 437 # set default values
- 438 self.maxEntriesInOptionList = 20
- 439 self.startDay = "Mo"
- 440 self.showAll = "0"
- 441
'entries'
- args = ('entries',)
System Details
- Date: Tue, 19 Dec 2006 04:51:16 +0000
- Platform: win32 (nt)
Python: Python 2.4.3 (C:\Documents and Settings\pdharan.ST-USERS\My Documents\MoinMoinDesktopEdition\moin.exe)
MoinMoin: Release 1.5.5a (97bf3d768af3 tip; DesktopEdition Release 1.5.5a-1)
Sorry I tossed this over the wall and left it, JBoss Rules http://markproctor.blogspot.com/ has really taken up all my time. I'm glad to see others have found this useful and continued to maintain it. I won't be coming back to this project, so if someone else wants to take 100% ownership, that's fine with me.