Slightly Some

Nucleus plugin: NP_LMCalendar

By: Leo
20/02-11, 18:52
Category: Code
NucleusCMS

Back when I started tinkering with Nucleus CMS (many years ago) was one of the first things i started to customize the NP_Calendar plugin. This was because I wanted more control over the CSS formatting of the calendar table. Especially wanted I to be able to use the border-radius attributes on the table.

I have made a new plugin called NP_LMCalendar based on the v0.73 version of the NP_Calendar plugin. The reason that I have used such an old version as a base for my plugin is that the main development on the plugin was done several years ago. I have later added some of the newer functionality from the NP_Calendar plugin to the NP_LMCalendar plugin.

Plugin description

NP_LMCalendar can be used to insert a calendar on a page in your blog. The calendar have links to the blog archive on the month and/or day level. The active category is preserved in archive links.

The calendar is build up as a table and the rows have been assigned classes to be able to format the table in the CSS document.

In addition to the classes on the rows have the four corner table cells also their own class. This is to enable the use of border-radius to make rounded corners. (Internet Explorer 8.0 or older don't support border-radius.)

If the calendar is on a month or day archive page will the cell in the table for the chosen month or date have a id to identify it. The purpose of this is to be able to highlight the chosen month or date in the calendar.

The plugin is installed as a normal plugin. To include a calendar in your skins use . You can also use , where myblog is the shortname of the blog you want to show the calendar for.

Example of CSS statments for formating the calendar

/*------------------------------------------------- 
*	Calendar table 
*/
.calendar
{
	margin: 10px auto 10px auto; 
	background-color: #FAFFE6;
	border: 1px solid #989898;
	-moz-border-radius: 6px;
	border-radius: 6px;
	border-spacing: 0px;
	line-height:150%;
}

.calendar td {
	padding: 0 0 0 0;
	margin: 0 0 0 0;
}

.calendar a {
	float: left;
	width: 100%;
	text-align: center;
	font-weight: bold;
	background-color: #FAE6F0;
	color: #000;
}

.calendar a:visited, #calactive a:visited {
	text-decoration: none;
	color: #000;
}

.calendar a:hover, #calactive a:hover {
	text-decoration: none;
	background-color: #E6E6FA;
	color: #000;	
}
/*------------------------------------------------- 
*	Highlight active archive month or day:
*/
#calactive a {
	background-color: #fff;
}
/*------------------------------------------------- 
*	First row with navigation links:
*/
.calheadnav td {
	border-right: 1px solid #989898;
}

.calheadnav .calnext {
	border-right: none; 
}
/*------------------------------------------------- 
*	Upper left and upper right table cell:
*/
.calprev, .calprev a {
	-moz-border-radius-topleft: 6px;
	border-top-left-radius: 6px;
}

.calnext, .calnext a {
	-moz-border-radius-topright: 6px;
	border-top-right-radius: 6px;
}
/*------------------------------------------------- 
*	Second row with day names:
*/
.calheaddays th {
	border-top: 1px solid #989898;
	border-right: 1px solid #989898; 
	background-color: #E6FAFA;
}

.calheaddays .calrowend {
	border-right: none; 
}
/*------------------------------------------------- 
*	Date rows with links:
*/
.caldays td {
	border-top: 1px solid #989898; 
	border-right: 1px solid #989898;
	text-align: right;
	padding: 0px 20px 0px 0;
	width: 40px;
}

.caldays .calrowend {
	border-right: none; 
}

.caldays .callastright {
	border-right: none; 
}

.caldays a {
	margin-right: -20px;
	padding-right: 20px;
	text-align: right;
}
/*-------------------------------------------------
*	Bottom left and bottom right cells:
*/
.callastright, .callastright a  {
	-moz-border-radius-bottomright: 6px;
	border-bottom-right-radius: 6px;
}

.callastleft, .callastleft a  {
	-moz-border-radius-bottomleft: 6px;
	border-bottom-left-radius: 6px;
}

Changes from NP_Calendar v0.73

v1.0 2011-02-20 Leo (http://www.slightlysome.net):

  • Generating class id for table, table rows and the four corners data cells.
  • Doesn't genereate previous month links past the oldest post.
  • Doesn't genereate next month links to months in the future.
  • Archive links uses dato/month text in title.
  • Use active category in archive links.
  • Only show links to days with posts in the active category when link all option is false.
  • Reritten to remove the use of <?php in code.
  • Various minor rewrites to clean up.

Download

Version 1.0 of NP_LMCalendar can be downloaded here.

Add new comment

Allowed BBCode:[b] [i] [u] [s] [color=] [size=] [quote] [code] [email] [url]

Comments must be approved before being published.

nucleuscms.org
Valid XHTML
Creative Commons License

Unless otherwise specified is all original material on this website licensed under a Creative Commons License.

Baronial