--- MoinMoin/macro/MonthCalendar.py	2010-08-22 00:42:37.812770363 +0200
+++ wiki/data/plugin/macro/MonthCalendar.py	2010-08-28 23:44:35.187180732 +0200
@@ -7,6 +7,7 @@
     BasePageName/year-month-day
 
     @copyright: 2002-2009 MoinMoin:ThomasWaldmann
+    @copyright: 2010 Modified by MarcelHaefner (http://moinmo.in/MoinMoinBugs/1.9%20MonthCalenderAndSidebarFunctionNotWorking)
     @license: GNU GPL, see COPYING for details.
 
     Revisions:
@@ -268,11 +269,11 @@
     p = Page(request, thispage)
     qpagenames = '*'.join([wikiutil.quoteWikinameURL(pn) for pn in parmpagename])
     qtemplate = wikiutil.quoteWikinameURL(parmtemplate)
-    querystr = "calparms=%%s,%d,%d,%d,%%d,,,%%s" % (parmyear, parmmonth, parmoffset)
-    prevlink = p.url(request, querystr % (qpagenames, parmoffset2 - 1, qtemplate))
-    nextlink = p.url(request, querystr % (qpagenames, parmoffset2 + 1, qtemplate))
-    prevylink = p.url(request, querystr % (qpagenames, parmoffset2 - 12, qtemplate))
-    nextylink = p.url(request, querystr % (qpagenames, parmoffset2 + 12, qtemplate))
+    querystr = "?calparms=%%s,%d,%d,%d,%%d,,,%%s" % (parmyear, parmmonth, parmoffset)
+    prevlink =  querystr % (qpagenames, parmoffset2 - 1, qtemplate)
+    nextlink = querystr % (qpagenames, parmoffset2 + 1, qtemplate)
+    prevylink = querystr % (qpagenames, parmoffset2 - 12, qtemplate)
+    nextylink = querystr % (qpagenames, parmoffset2 + 12, qtemplate)
 
     prevmonth = formatter.url(1, prevlink, 'cal-link', **attrs) + '&lt;' + formatter.url(0)
     nextmonth = formatter.url(1, nextlink, 'cal-link', **attrs) + '&gt;' + formatter.url(0)
@@ -389,7 +390,11 @@
                             r, g, b = (r, g+colorstep, b)
                 r, g, b = cliprgb(r, g, b)
                 style = 'background-color:#%02x%02x%02x' % (r, g, b)
-                fmtlink = formatter.url(1, daypage.url(request, query), csslink, **attrs) + str(day) + formatter.url(0)
+                if has_calparms:
+                    calparmslink = "?calparms=" + macro.request.args['calparms']
+                else:
+                    calparmslink = ""
+                fmtlink = formatter.url(1, daypage.url(request, query) + calparmslink, csslink, **attrs) + str(day) + formatter.url(0)
                 if day == currentday and month == currentmonth and year == currentyear:
                     cssday = "cal-today"
                     fmtlink = "<b>%s</b>" % fmtlink # for browser with CSS probs
