Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
png
CalendarExample.png 2.9 kB 1 20-Apr-2004 18:09 MDeichsel

This page (revision-17) was last changed on 09-Mar-2006 16:11 by 192.18.1.5  

This page was created on 26-Aug-2003 11:30 by FrancoisParlant

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 70 added 10 lines
!I'd like to use the Calendar not only for blogs
In my wiki 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 81 added 101 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%; }
}}}
----
Version Date Modified Size Author Changes ... Change note
17 09-Mar-2006 16:11 7.147 kB 192.18.1.5 to previous
16 09-Mar-2006 16:10 7.093 kB 192.18.1.5 to previous | to last
15 15-Mar-2005 23:29 6.889 kB 83.131.134.241 to previous | to last
14 15-Mar-2005 23:26 6.965 kB 83.131.134.241 to previous | to last
13 21-Apr-2004 13:44 6.889 kB MDeichsel to previous | to last
12 20-Apr-2004 18:11 6.871 kB MDeichsel to previous | to last
11 20-Apr-2004 18:09 6.858 kB MDeichsel to previous | to last
10 20-Apr-2004 18:07 6.833 kB MDeichsel to previous | to last
9 18-Sep-2003 12:27 3.242 kB JanneJalkanen to previous | to last
8 17-Sep-2003 23:54 2.958 kB JoseMRus to previous | to last
7 27-Aug-2003 21:26 2.668 kB FrancoisParlant to previous | to last
6 26-Aug-2003 22:22 3.645 kB JanneJalkanen to previous | to last
5 26-Aug-2003 22:21 3.634 kB JanneJalkanen to previous | to last
4 26-Aug-2003 15:13 1.872 kB JanneJalkanen to previous | to last
3 26-Aug-2003 11:39 1.59 kB FrancoisParlant to previous | to last
2 26-Aug-2003 11:35 1.32 kB FrancoisParlant to previous | to last
1 26-Aug-2003 11:30 1.12 kB FrancoisParlant to last
« This page (revision-17) was last changed on 09-Mar-2006 16:11 by 192.18.1.5