At line 65 added 4 lines |
In 2.2 you can do it by saying [[{SET template='weblogtemplate'}] on your weblog page. This allows you to have different templates: one with the calendar and one without the calendar (for normal wiki pages). You can also do the same thing with stylesheets... |
|
-- JanneJalkanen |
|
At line 70 added 12 lines |
!I'd like to use the Calendar not only for blogs |
-- [MDeichsel]\\ |
[CalendarExample.png]\\ |
In my wiki-installation I would like to add 'blog-entries' to days in the past or in the future (like a normal calendar) not only for the current day. I know that you can do this by editing the URL but I was looking for a more convenient method. |
For this reason I've done some minor modifications: |
* remove the condition that restricts the calendar-navigation to the current date. |
* changed the implementation of ''getDayLink()''. The main goal of this change is that days without existing blog-entry are rendered using an anchor-tag whose ''onDblClick''-event is used to switch to the edit-view for the blog-entry of this date. So a double-click will create a new blog-entry for the relevant day. |
{{{ |
private String getDayLink(Calendar day) |
{ |
WikiEngine engine = m_wikiContext.getEngine(); |
StringBuffer result = new StringBuffer(); |
At line 83 added 105 lines |
Calendar cal = Calendar.getInstance(); |
cal.set(Calendar.HOUR_OF_DAY, 0); |
cal.set(Calendar.MINUTE, 0); |
cal.set(Calendar.SECOND, 0); |
cal.set(Calendar.MILLISECOND, 0); |
|
Date today = cal.getTime(); |
cal.add(Calendar.DAY_OF_MONTH, 1); |
Date tomorrow = cal.getTime(); |
String pagename = |
m_pageFormat != null ? m_pageFormat.format(day.getTime()) : null; |
String url = |
m_urlFormat != null ? m_urlFormat.format(day.getTime()) : null; |
|
StringBuffer sb = new StringBuffer(); |
sb.append("days"); |
int weekDay = day.get(Calendar.DAY_OF_WEEK); |
if (weekDay == Calendar.SATURDAY || weekDay == Calendar.SUNDAY) |
{ |
sb.append("Weekend"); |
} |
|
boolean isToday = |
!day.getTime().before(today) && day.getTime().before(tomorrow); |
if (isToday) |
{ |
sb.append("Today"); |
} |
|
result.append("<td class=\""); |
|
if ((pagename != null && engine.pageExists(pagename)) || url != null) |
{ |
sb.append("Link"); |
} |
|
result.append(sb.toString()).append("\"><a"); |
|
if (pagename != null && engine.pageExists(pagename)) |
{ |
if (url != null) |
{ |
result.append(" href=\"").append(url).append("\""); |
} |
else |
{ |
result.append(" href=\"").append( |
engine.getViewURL(pagename)).append( |
"\""); |
} |
} |
else if (pagename == null && url != null) |
{ |
result.append(" href=\"").append(url).append("\""); |
} |
else |
{ |
if (pagename != null) |
{ |
result |
.append(" onDblClick=\"javascript:document.location.replace('") |
.append(engine.getEditURL(pagename)) |
.append("')\""); |
} |
} |
|
result.append(">").append(day.get(Calendar.DATE)); |
result.append("</a></td>"); |
return result.toString(); |
} |
}}} |
* Add some styles to ''jsswiki.css'' |
{{{ |
/* ----- For the CalendarTag -----------------------------*/ |
|
TABLE.calendar { |
padding: 4; |
spacing: 4; |
color: white; |
text-align: center; |
} |
|
TD.month { font-weight: bold; } |
|
TD.weekdays { font-size: 85%; } |
|
TD.days { background: #9999aa; } |
TD.daysWeekend { background: #ccccee; } |
TD.daysToday { background: #9999aa; border-style: solid; border-color: #dd2222;} |
TD.daysWeekendToday { background: #ccccee; border-style: solid; border-color: #dd2222;} |
|
TD.daysLink { background: #dddddd; } |
TD.daysWeekendLink { background: white; } |
TD.daysTodayLink { background: #dddddd; border-style: solid; border-color: #dd2222;} |
TD.daysWeekendTodayLink { background: white; border-style: solid; border-color: #dd2222;} |
|
TD.othermonth { color: #707070; |
font-size: 75%; } |
}}} |
---- |
!Question: How can i get the calendar to show >> to next month. |
When viewing the current month, I would like the calendar to show << and >> but currently it only has a link to past dates (Imagine today is April & look at the atached png). \\ |
thanks |
|
---- |