Index: xwiki-clients/p2pxwiki/src/main/web/WEB-INF/xwiki.cfg =================================================================== --- xwiki-clients/p2pxwiki/src/main/web/WEB-INF/xwiki.cfg (revision 3312) +++ xwiki-clients/p2pxwiki/src/main/web/WEB-INF/xwiki.cfg (working copy) @@ -98,3 +98,7 @@ #p2pxwiki.network.server_port=8685 #p2pxwiki.network.connector_factory=com.xpn.p2pxwiki.communication.jxtarpc.JxtaRpcConnectionFactory #p2pxwiki.network.retry_with_default_connector_factory=false + +# Calendar Prev/Next Month bounds +xwiki.calendarprevmonthbound=6 +xwiki.calendarnextmonthbound=12 Index: xwiki/application/src/main/resources/xwiki.cfg =================================================================== --- xwiki/application/src/main/resources/xwiki.cfg (revision 3312) +++ xwiki/application/src/main/resources/xwiki.cfg (working copy) @@ -103,3 +103,7 @@ # Enable to allow superadmin. It is disabled by default as this could be a security breach if # it were set and you forgot about it. #xwiki.superadminpassword=system + +# Calendar Prev/Next Month bounds +xwiki.calendarprevmonthbound=6 +xwiki.calendarnextmonthbound=12 Index: xwiki/core/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarModel.java =================================================================== --- xwiki/core/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarModel.java (revision 3312) +++ xwiki/core/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarModel.java (working copy) @@ -23,6 +23,7 @@ import java.util.Calendar; import java.util.Date; +import com.xpn.xwiki.XWikiContext; //added 18.05.07 by Danciu Radu JIRA XWIKI-980 /** * Model interface for the CalendarTag. The CalendarTag will set a day, then use the computeUrl method to get the URLs it needs. @@ -36,11 +37,13 @@ public Date getNextMonth(); - public String computePrevMonthUrl(); - public String computeTodayMonthUrl(); + + //modified 18.05.07 by Danciu Radu JIRA XWIKI-980 + public String computePrevMonthUrl(XWikiContext context); - public String computeNextMonthUrl(); + public String computeNextMonthUrl(XWikiContext context); + //** /** * Create URL for use on edit-weblog page, preserves the request parameters used by the tabbed-menu tag for navigation. Index: xwiki/core/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarParams.java =================================================================== --- xwiki/core/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarParams.java (revision 3312) +++ xwiki/core/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarParams.java (working copy) @@ -19,6 +19,7 @@ */ package com.xpn.xwiki.plugin.calendar; +import com.xpn.xwiki.XWikiContext; //added 18.05.07 by Danciu Radu JIRA XWIKI-980 import java.util.*; @@ -69,20 +70,47 @@ } return cal; } - public String computePrevMonthURL() { - Calendar c = this.getCalendar(Locale.getDefault()); - c.add(Calendar.MONTH, -1); - if (c.get(Calendar.YEAR) != Calendar.getInstance().get(Calendar.YEAR)) { - return "?year=" + c.get(Calendar.YEAR) + "&month=" + c.get(Calendar.MONTH); - } - return "?month=" + c.get(Calendar.MONTH); - } - public String computeNextMonthURL() { - Calendar c = this.getCalendar(Locale.getDefault()); - c.add(Calendar.MONTH, 1); - if (c.get(Calendar.YEAR) != Calendar.getInstance().get(Calendar.YEAR)) { - return "?year=" + c.get(Calendar.YEAR) + "&month=" + c.get(Calendar.MONTH); - } - return "?month=" + c.get(Calendar.MONTH); - } -} + public String computePrevMonthURL(XWikiContext context) { + Calendar c = this.getCalendar(Locale.getDefault()); + + //modified 18.05.07 by Danciu Radu JIRA XWIKI-980 + String prevMonthBound; + int prevBound; + if ((prevMonthBound = context.getWiki().Param("xwiki.calendarprevmonthbound")) != null) + prevBound = Integer.parseInt (prevMonthBound); + else + prevBound = 6; + + if (Calendar.getInstance().get(Calendar.MONTH) - c.get(Calendar.MONTH) + 12 * (Calendar.getInstance().get(Calendar.YEAR) - c.get(Calendar.YEAR)) < prevBound) + { + c.add(Calendar.MONTH, -1); + if (c.get(Calendar.YEAR) != Calendar.getInstance().get(Calendar.YEAR)) { + return "?year=" + c.get(Calendar.YEAR) + "&month=" + c.get(Calendar.MONTH); + } + return "?month=" + c.get(Calendar.MONTH); + } + return ""; + //*** + } + public String computeNextMonthURL(XWikiContext context) { + Calendar c = this.getCalendar(Locale.getDefault()); + + //modified 18.05.07 by Danciu Radu JIRA XWIKI-980 + String nextMonthBound; + int nextBound; + if ((nextMonthBound = context.getWiki().Param("xwiki.calendarnextmonthbound")) != null) + nextBound = Integer.parseInt (nextMonthBound); + else + nextBound = 12; + if (c.get(Calendar.MONTH) - Calendar.getInstance().get(Calendar.MONTH) + 12 * (c.get(Calendar.YEAR) - Calendar.getInstance().get(Calendar.YEAR)) < nextBound) + { + c.add(Calendar.MONTH, 1); + if (c.get(Calendar.YEAR) != Calendar.getInstance().get(Calendar.YEAR)) { + return "?year=" + c.get(Calendar.YEAR) + "&month=" + c.get(Calendar.MONTH); + } + return "?month=" + c.get(Calendar.MONTH); + } + return ""; + //*** + } +} Index: xwiki/core/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarPlugin.java =================================================================== --- xwiki/core/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarPlugin.java (revision 3312) +++ xwiki/core/src/main/java/com/xpn/xwiki/plugin/calendar/CalendarPlugin.java (working copy) @@ -159,16 +159,36 @@ // ------------------------- // --- draw the calendar --- // ------------------------- + + String tempMonthURL; + output.append(""); output.append(""); - output.append(""); + + //modified 18.05.07 by Danciu Radu JIRA XWIKI-980 + if ((tempMonthURL = calendarParams.computePrevMonthURL(context)) != "") + { + tempMonthURL = "<"; + } + + output.append(""); + //*** + output.append(""); - output.append(""); + + //modified 18.05.07 by Danciu Radu JIRA XWIKI-980 + if ((tempMonthURL = calendarParams.computeNextMonthURL(context)) != "") + { + tempMonthURL = ">"; + } + //*** + + output.append(""); output.append(""); // emit the HTML calendar Index: xwiki/standalone/config/xwiki.cfg =================================================================== --- xwiki/standalone/config/xwiki.cfg (revision 3312) +++ xwiki/standalone/config/xwiki.cfg (working copy) @@ -114,3 +114,7 @@ xwiki.defaultskin=albatross xwiki.defaultbaseskin=albatross + +# Calendar Prev/Next Month bounds +xwiki.calendarprevmonthbound=6 +xwiki.calendarnextmonthbound=12 Index: xwiki/tests/resources/xwiki.cfg =================================================================== --- xwiki/tests/resources/xwiki.cfg (revision 3312) +++ xwiki/tests/resources/xwiki.cfg (working copy) @@ -64,4 +64,8 @@ xwiki.defaultskin=albatross xwiki.defaultbaseskin=albatross -xwiki.upload.tempdir=/tmp \ No newline at end of file +xwiki.upload.tempdir=/tmp + +# Calendar Prev/Next Month bounds +xwiki.calendarprevmonthbound=6 +xwiki.calendarnextmonthbound=12 \ No newline at end of file Index: xwiki/web/exo/src/main/webapp/WEB-INF/xwiki.cfg =================================================================== --- xwiki/web/exo/src/main/webapp/WEB-INF/xwiki.cfg (revision 3312) +++ xwiki/web/exo/src/main/webapp/WEB-INF/xwiki.cfg (working copy) @@ -104,3 +104,7 @@ xwiki.defaultskin=default xwiki.defaultbaseskin=default + +# Calendar Prev/Next Month bounds +xwiki.calendarprevmonthbound=6 +xwiki.calendarnextmonthbound=12 Index: xwiki/web/standard/src/main/webapp/WEB-INF/version.properties =================================================================== --- xwiki/web/standard/src/main/webapp/WEB-INF/version.properties (revision 3312) +++ xwiki/web/standard/src/main/webapp/WEB-INF/version.properties (working copy) @@ -1,2 +1,2 @@ -#Fri Apr 27 17:21:11 CEST 2007 -build.number=1704 +#Fri May 18 23:27:55 EEST 2007 +build.number=1733 Index: xwiki/web/standard/src/main/webapp/WEB-INF/xwiki.cfg =================================================================== --- xwiki/web/standard/src/main/webapp/WEB-INF/xwiki.cfg (revision 3312) +++ xwiki/web/standard/src/main/webapp/WEB-INF/xwiki.cfg (working copy) @@ -114,3 +114,7 @@ xwiki.defaultskin=albatross xwiki.defaultbaseskin=albatross + +# Calendar Prev/Next Month bounds +xwiki.calendarprevmonthbound=6 +xwiki.calendarnextmonthbound=12
<" + tempMonthURL + ""); output.append(formatTitle.format(dayCal.getTime())); output.append(">" + tempMonthURL + "