Browse Source

Part I

The first part of the calendar "overhaul". Committed in two pieces to
work on another branch temporarily.
Matthew Kerle 12 years ago
parent
commit
fcadeeb4b1

+ 1 - 1
.gitignore

@@ -46,4 +46,4 @@ Thumbs.db
 /nbproject/private/
 /nbproject/
 .directory
-
+.idea/

+ 14 - 11
Sources/Calendar.php

@@ -91,11 +91,17 @@ function CalendarMain()
 		'show_birthdays' => in_array($modSettings['cal_showbdays'], array(1, 2)),
 		'show_events' => in_array($modSettings['cal_showevents'], array(1, 2)),
 		'show_holidays' => in_array($modSettings['cal_showholidays'], array(1, 2)),
-		'show_week_num' => true,
-		'short_day_titles' => false,
-		'show_next_prev' => true,
-		'show_week_links' => true,
-		'size' => 'large',
+		'highlight' => array(
+			'events' => isset($modSettings['cal_highlight_events']) ? $modSettings['cal_highlight_events'] : 0,
+			'holidays' => isset($modSettings['cal_highlight_holidays']) ? $modSettings['cal_highlight_holidays'] : 0,
+			'birthdays' => isset($modSettings['cal_highlight_birthdays']) ? $modSettings['cal_highlight_birthdays'] : 0,
+		),
+		'show_week_num' => !empty($modSettings['cal_week_numbers']),
+		'short_day_titles' => !empty($modSettings['cal_short_days']),
+		'short_month_titles' => !empty($modSettings['cal_short_months']),
+		'show_next_prev' => !empty($modSettings['cal_prev_next_links']),
+		'show_week_links' => isset($modSettings['cal_week_links']) ? $modSettings['cal_week_links'] : 0,
+		'size' => empty($modSettings['cal_display_type']) ? 'large' : 'small',
 	);
 
 	// Load up the main view.
@@ -105,15 +111,11 @@ function CalendarMain()
 		$context['calendar_grid_main'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions);
 
 	// Load up the previous and next months.
-	$calendarOptions['show_birthdays'] = $calendarOptions['show_events'] = $calendarOptions['show_holidays'] = false;
-	$calendarOptions['short_day_titles'] = true;
-	$calendarOptions['show_next_prev'] = false;
-	$calendarOptions['show_week_links'] = false;
-	$calendarOptions['size'] = 'small';
+	//$calendarOptions['show_birthdays'] = $calendarOptions['show_events'] = $calendarOptions['show_holidays'] = false;
 	$context['calendar_grid_current'] = getCalendarGrid($curPage['month'], $curPage['year'], $calendarOptions);
 	// Only show previous month if it isn't pre-January of the min-year
 	if ($context['calendar_grid_current']['previous_calendar']['year'] > $modSettings['cal_minyear'] || $curPage['month'] != 1)
-		$context['calendar_grid_prev'] = getCalendarGrid($context['calendar_grid_current']['previous_calendar']['month'], $context['calendar_grid_current']['previous_calendar']['year'], $calendarOptions);
+		$context['calendar_grid_prev'] = getCalendarGrid($context['calendar_grid_current']['previous_calendar']['month'], $context['calendar_grid_current']['previous_calendar']['year'], $calendarOptions, true);
 	// Only show next month if it isn't post-December of the max-year
 	if ($context['calendar_grid_current']['next_calendar']['year'] < $modSettings['cal_maxyear'] || $curPage['month'] != 12)
 		$context['calendar_grid_next'] = getCalendarGrid($context['calendar_grid_current']['next_calendar']['month'], $context['calendar_grid_current']['next_calendar']['year'], $calendarOptions);
@@ -124,6 +126,7 @@ function CalendarMain()
 	$context['current_month'] = $curPage['month'];
 	$context['current_year'] = $curPage['year'];
 	$context['show_all_birthdays'] = isset($_GET['showbd']);
+	$context['blocks_disabled'] = !empty($modSettings['cal_disable_prev_next']) ? 1 : 0;
 
 	// Set the page title to mention the month or week, too
 	$context['page_title'] .= ' - ' . ($context['view_week'] ? sprintf($txt['calendar_week_title'], $context['calendar_grid_main']['week_number'], ($context['calendar_grid_main']['week_number'] == 53 ? $context['current_year'] - 1 : $context['current_year'])) : $txt['months'][$context['current_month']] . ' ' . $context['current_year']);

+ 14 - 0
Sources/ManageCalendar.php

@@ -333,6 +333,20 @@ function ModifyCalendarSettings($return_config = false)
 			// Calendar spanning...
 			array('check', 'cal_allowspan'),
 			array('int', 'cal_maxspan', 6, 'postinput' => $txt['days_word']),
+		'',
+			// A comment is like a dog marking its territory. ;)
+			array('select', 'cal_highlight_events', array(0 => $txt['setting_cal_highlight_none'], 1 => $txt['setting_cal_highlight_mini'], 2 => $txt['setting_cal_highlight_main'], 3 => $txt['setting_cal_highlight_both'])),
+			array('select', 'cal_highlight_holidays', array(0 => $txt['setting_cal_highlight_none'], 1 => $txt['setting_cal_highlight_mini'], 2 => $txt['setting_cal_highlight_main'], 3 => $txt['setting_cal_highlight_both'])),
+			array('select', 'cal_highlight_birthdays', array(0 => $txt['setting_cal_highlight_none'], 1 => $txt['setting_cal_highlight_mini'], 2 => $txt['setting_cal_highlight_main'], 3 => $txt['setting_cal_highlight_both'])),
+		'',
+			// Miscellaneous layout settings...
+			array('check', 'cal_disable_prev_next'),
+			array('select', 'cal_display_type', array(0 => $txt['setting_cal_display_comfortable'], 1 => $txt['setting_cal_display_compact'])),
+			array('select', 'cal_week_links', array(0 => $txt['setting_cal_week_links_none'], 1 => $txt['setting_cal_week_links_mini'], 2 => $txt['setting_cal_week_links_main'], 3 => $txt['setting_cal_week_links_both'])),
+			array('check', 'cal_prev_next_links'),
+			array('check', 'cal_short_days'),
+			array('check', 'cal_short_months'),
+			array('check', 'cal_week_numbers'),
 	);
 
 	call_integration_hook('integrate_modify_calendar_settings', array(&$config_vars));

+ 19 - 4
Sources/Subs-Calendar.php

@@ -307,21 +307,28 @@ function getTodayInfo()
  * @param int $month
  * @param int $year
  * @param array $calendarOptions
+ * @param int $is_previous
  * @return array containing all the information needed to show a calendar grid for the given month
  */
-function getCalendarGrid($month, $year, $calendarOptions)
+function getCalendarGrid($month, $year, $calendarOptions, $is_previous = false)
 {
-	global $scripturl, $modSettings;
+	global $scripturl, $modSettings, $context;
 
 	// Eventually this is what we'll be returning.
 	$calendarGrid = array(
 		'week_days' => array(),
 		'weeks' => array(),
 		'short_day_titles' => !empty($calendarOptions['short_day_titles']),
+		'short_month_titles' => !empty($calendarOptions['short_month_titles']),
+		'highlight' => array(
+			'events' => !empty($calendarOptions['highlight']['events']) && !empty($calendarOptions['show_events']) ? $calendarOptions['highlight']['events'] : 0,
+			'holidays' => !empty($calendarOptions['highlight']['holidays']) && !empty($calendarOptions['show_holidays']) ? $calendarOptions['highlight']['holidays'] : 0,
+			'birthdays' => !empty($calendarOptions['highlight']['birthdays']) && !empty($calendarOptions['show_birthdays']) ? $calendarOptions['highlight']['birthdays'] : 0,
+		),
 		'current_month' => $month,
 		'current_year' => $year,
 		'show_next_prev' => !empty($calendarOptions['show_next_prev']),
-		'show_week_links' => !empty($calendarOptions['show_week_links']),
+		'show_week_links' => isset($calendarOptions['show_week_links']) ? $calendarOptions['show_week_links'] : 0,
 		'previous_calendar' => array(
 			'year' => $month == 1 ? $year - 1 : $year,
 			'month' => $month == 1 ? 12 : $month - 1,
@@ -444,13 +451,21 @@ function getCalendarGrid($month, $year, $calendarOptions)
 				'date' => $date,
 				'is_today' => $date == $today['date'],
 				'is_first_day' => !empty($calendarOptions['show_week_num']) && (($month_info['first_day']['day_of_week'] + $nDay - 1) % 7 == $calendarOptions['start_day']),
+				'is_first_of_month' => $nDay === 1,
 				'holidays' => !empty($holidays[$date]) ? $holidays[$date] : array(),
 				'events' => !empty($events[$date]) ? $events[$date] : array(),
-				'birthdays' => !empty($bday[$date]) ? $bday[$date] : array()
+				'birthdays' => !empty($bday[$date]) ? $bday[$date] : array(),
 			);
 		}
 	}
 
+	// What is the last day of the month?
+	if ($is_previous === true)
+		$calendarGrid['last_of_month'] = $month_info['last_day']['day_of_month'];
+
+	// A comment is like...a dog marking its territory. ;)
+	$calendarGrid['shift'] = $nShift;
+
 	// Set the previous and the next month's links.
 	$calendarGrid['previous_calendar']['href'] = $scripturl . '?action=calendar;year=' . $calendarGrid['previous_calendar']['year'] . ';month=' . $calendarGrid['previous_calendar']['month'];
 	$calendarGrid['next_calendar']['href'] = $scripturl . '?action=calendar;year=' . $calendarGrid['next_calendar']['year'] . ';month=' . $calendarGrid['next_calendar']['month'];

+ 1 - 1
Themes/default/BoardIndex.template.php

@@ -340,7 +340,7 @@ function template_info_center()
 		// Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P.
 		if (!empty($context['calendar_holidays']))
 			echo '
-				<p class="inline holiday">', $txt['calendar_prompt'], ' ', implode(', ', $context['calendar_holidays']), '</p>';
+				<p class="inline holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $context['calendar_holidays']), '</p>';
 
 		// People's birthdays. Like mine. And yours, I guess. Kidding.
 		if (!empty($context['calendar_birthdays']))

+ 222 - 148
Themes/default/Calendar.template.php

@@ -14,44 +14,44 @@
 function template_main()
 {
 	global $context, $settings, $options, $txt, $scripturl, $modSettings;
-
-	echo '
-		<div id="calendar">
+	echo '<div id="calendar">';
+	if (empty($context['blocks_disabled']))
+	{
+		echo '
 			<div id="month_grid">
-				', template_show_month_grid('prev'), '
-				', template_show_month_grid('current'), '
-				', template_show_month_grid('next'), '
+				', template_show_month_grid('prev', true), '
+				', template_show_month_grid('current', true), '
+				', template_show_month_grid('next', true), '
 			</div>
-			<div id="main_grid">
-				', $context['view_week'] ? template_show_week_grid('main') : template_show_month_grid('main');
-
-	template_button_strip($context['calendar_buttons'], 'right');
-
-	// Show some controls to allow easy calendar navigation.
-	echo '
-				<form id="calendar_navigation" action="', $scripturl, '?action=calendar" method="post" accept-charset="', $context['character_set'], '">
-					<select name="month">';
-
-	// Show a select box with all the months.
-	foreach ($txt['months'] as $number => $month)
-		echo '
-						<option value="', $number, '"', $number == $context['current_month'] ? ' selected="selected"' : '', '>', $month, '</option>';
-	echo '
-					</select>
-					<select name="year">';
-
-	// Show a link for every year.....
-	for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++)
-		echo '
-						<option value="', $year, '"', $year == $context['current_year'] ? ' selected="selected"' : '', '>', $year, '</option>';
-	echo '
-					</select>
-					<input type="submit" class="button_submit" value="', $txt['view'], '" />';
-
+		';
+	}
 	echo '
-				</form>
+			<div id="', !empty($_GET['viewweek']) ? 'week_grid' : 'main_grid', '"', !empty($context['blocks_disabled']) ? ' style="width: 100%;"' : '', '>
+				', $context['view_week'] ? template_show_week_grid('main') : template_show_month_grid('main'), '
+				<div id="footer_cont">
+					', template_button_strip($context['calendar_buttons'], 'right'), '
+					<form action="', $scripturl, '?action=calendar" id="calendar_navigation" method="post" accept-charset="', $context['character_set'], '">
+						<select name="month" id="input_month">';
+						// Show a select box with all the months.
+						foreach ($txt['months'] as $number => $month)
+						{
+							echo '<option value="', $number, '"', $number == $context['current_month'] ? ' selected="selected"' : '', '>', $month, '</option>';
+						}
+						echo '</select>
+						<select name="year">';
+						// Show a link for every year.....
+						for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++)
+						{
+							echo '<option value="', $year, '"', $year == $context['current_year'] ? ' selected="selected"' : '', '>', $year, '</option>';
+						}
+						echo '</select>
+						<input type="submit" class="button_submit" value="', $txt['view'], '" />
+					</form>
+				</div>
 			</div>
-		</div>';
+			<br class="clear" />
+		</div>
+	';
 }
 
 // Template for posting a calendar event.
@@ -61,13 +61,15 @@ function template_event_post()
 
 	// Start the javascript for drop down boxes...
 	echo '
-		<script type="text/javascript"><!-- // --><![CDATA[
-			var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
-
+		<script><!-- // --><![CDATA[
+			var monthLength;
+			monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
 			function generateDays()
 			{
-				var days = 0, selected = 0;
-				var dayElement = document.getElementById("day"), yearElement = document.getElementById("year"), monthElement = document.getElementById("month");
+				var days, selected, dayElement;
+				
+				days = 0, selected = 0;
+				dayElement = document.getElementById("day"), yearElement = document.getElementById("year"), monthElement = document.getElementById("month");
 
 				monthLength[1] = 28;
 				if (yearElement.options[yearElement.selectedIndex].value % 4 == 0)
@@ -229,7 +231,7 @@ function template_event_post()
 }
 
 // Display a monthly calendar grid.
-function template_show_month_grid($grid_name)
+function template_show_month_grid($grid_name, $is_mini = false)
 {
 	global $context, $settings, $options, $txt, $scripturl, $modSettings, $smcFunc;
 
@@ -243,22 +245,30 @@ function template_show_month_grid($grid_name)
 	{
 		echo '
 			<div class="cat_bar">
-				<h3 class="catbg centertext" style="font-size: ', $calendar_data['size'] == 'large' ? 'large' : 'small', ';">';
+				<h3 class="catbg centertext" style="font-size: large;">';
 
-		if (empty($calendar_data['previous_calendar']['disabled']) && $calendar_data['show_next_prev'])
-			echo '
-					<span class="floatleft"><a href="', $calendar_data['previous_calendar']['href'], '">&#171;</a></span>';
-
-		if (empty($calendar_data['next_calendar']['disabled']) && $calendar_data['show_next_prev'])
+		if (empty($calendar_data['previous_calendar']['disabled']) && $calendar_data['show_next_prev'] && $is_mini === false)
+		{
 			echo '
-					<span class="floatright"><a href="', $calendar_data['next_calendar']['href'], '">&#187;</a></span>';
+				<span class="floatleft">
+					<a href="', $calendar_data['previous_calendar']['href'], '">&#171;</a>
+				</span>
+			';
+		}
 
 		if ($calendar_data['show_next_prev'])
-			echo '
-					', $txt['months_titles'][$calendar_data['current_month']], ' ', $calendar_data['current_year'];
+			echo $txt['months_titles'][$calendar_data['current_month']], ' ', $calendar_data['current_year'];
 		else
+			echo '<a href="', $scripturl, '?action=calendar;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], '">', $txt['months_titles'][$calendar_data['current_month']], ' ', $calendar_data['current_year'], '</a>';
+
+		if (empty($calendar_data['next_calendar']['disabled']) && $calendar_data['show_next_prev'] && $is_mini === false)
+		{
 			echo '
-					<a href="', $scripturl, '?action=calendar;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], '">', $txt['months_titles'][$calendar_data['current_month']], ' ', $calendar_data['current_year'], '</a>';
+				<span class="floatright">
+					<a href="', $calendar_data['next_calendar']['href'], '">&#187;</a>
+				</span>
+			';
+		}
 
 		echo '
 				</h3>
@@ -266,22 +276,27 @@ function template_show_month_grid($grid_name)
 	}
 
 	echo '
-				<table cellspacing="1" class="calendar_table">';
+				<table class="calendar_table">';
+
+	if (isset($calendar_data['show_week_links']) && ($calendar_data['show_week_links'] == 3 || (($calendar_data['show_week_links'] == 1 && $is_mini === true) || $calendar_data['show_week_links'] == 2 && $is_mini === false)))
+		$show_week_links = true;
+	else
+		$show_week_links = false;
 
 	// Show each day of the week.
 	if (empty($calendar_data['disable_day_titles']))
 	{
 		echo '
-					<tr class="titlebg2">';
+					<tr>';
 
-		if (!empty($calendar_data['show_week_links']))
+		if ($show_week_links === true)
 			echo '
 						<th>&nbsp;</th>';
 
 		foreach ($calendar_data['week_days'] as $day)
 		{
 			echo '
-						<th class="days" scope="col" ', $calendar_data['size'] == 'small' ? 'style="font-size: x-small;"' : '', '>', !empty($calendar_data['short_day_titles']) ? ($smcFunc['substr']($txt['days'][$day], 0, 1)) : $txt['days'][$day], '</th>';
+						<th class="days" scope="col">', !empty($calendar_data['short_day_titles']) || $is_mini === true ? $txt['days_short'][$day] : $txt['days'][$day], '</th>';
 		}
 		echo '
 					</tr>';
@@ -292,9 +307,9 @@ function template_show_month_grid($grid_name)
 	foreach ($calendar_data['weeks'] as $week)
 	{
 		echo '
-					<tr>';
+					<tr class="days_wrapper">';
 
-		if (!empty($calendar_data['show_week_links']))
+		if ($show_week_links === true)
 			echo '
 						<td class="windowbg2 weeks">
 							<a href="', $scripturl, '?action=calendar;viewweek;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $week['days'][0]['day'], '">&#187;</a>
@@ -303,34 +318,73 @@ function template_show_month_grid($grid_name)
 		/* Every day has the following:
 			day (# in month), is_today (is this day *today*?), is_first_day (first day of the week?),
 			holidays, events, birthdays. (last three are lists.) */
+		$current_month_started = false;
+		$count = 1;
+		$final_count = 1;
+		$shift = $calendar_data['shift'];
 		foreach ($week['days'] as $day)
 		{
+
+			// How should we be higlighted or otherwise not...?
+			$classes = array('days');
+			if (!empty($day['day']))
+			{
+
+				$classes[] = $calendar_data['size'] == 'small' ? 'compact' : 'comfortable';
+				$classes[] = !empty($day['is_today']) ? 'calendar_today' : 'windowbg';
+
+				if (!empty($day['events']) && !empty($calendar_data['highlight']['events']))
+				{
+					if ($is_mini === true && in_array($calendar_data['highlight']['events'], array(1,3)))
+						$classes[] = 'events';
+					elseif ($is_mini === false && in_array($calendar_data['highlight']['events'], array(2,3)))
+						$classes[] = 'events';
+				}
+				if (!empty($day['holidays']) && !empty($calendar_data['highlight']['holidays']))
+				{
+					if ($is_mini === true && in_array($calendar_data['highlight']['holidays'], array(1,3)))
+						$classes[] = 'holidays';
+					elseif ($is_mini === false && in_array($calendar_data['highlight']['holidays'], array(2,3)))
+						$classes[] = 'holidays';
+				}
+				if (!empty($day['birthdays']) && !empty($calendar_data['highlight']['birthdays']))
+				{
+					if ($is_mini === true && in_array($calendar_data['highlight']['birthdays'], array(1,3)))
+						$classes[] = 'birthdays';
+					elseif ($is_mini === false && in_array($calendar_data['highlight']['birthdays'], array(2,3)))
+						$classes[] = 'birthdays';
+				}
+			}
+			else
+				$classes[] = 'disabled';
+
 			// If this is today, make it a different color and show a border.
 			echo '
-						<td style="height: ', $calendar_data['size'] == 'small' ? '20' : '100', 'px; padding: 2px;', $calendar_data['size'] == 'small' ? 'font-size: x-small;' : '', '" class="', $day['is_today'] ? 'calendar_today' : 'windowbg', ' days">';
+						<td class="', implode(' ', $classes), '">';
 
 			// Skip it if it should be blank - it's not a day if it has no number.
 			if (!empty($day['day']))
 			{
+				$title_prefix = !empty($day['is_first_of_month']) && $context['current_month'] == $calendar_data['current_month'] && $is_mini === false ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$calendar_data['current_month']] . ' ' : $txt['months_titles'][$calendar_data['current_month']] . ' ') : '';
+
 				// Should the day number be a link?
 				if (!empty($modSettings['cal_daysaslink']) && $context['can_post'])
 					echo '
-							<a href="', $scripturl, '?action=calendar;sa=post;month=', $calendar_data['current_month'], ';year=', $calendar_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $day['day'], '</a>';
+							<a href="', $scripturl, '?action=calendar;sa=post;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '"><span class="day_text">', $title_prefix, $day['day'], '</span></a>';
 				else
-					echo '
-							', $day['day'];
+					echo '<span class="day_text">', $title_prefix, $day['day'], '</span>';
 
 				// Is this the first day of the week? (and are we showing week numbers?)
-				if ($day['is_first_day'] && $calendar_data['size'] != 'small')
+				if ($day['is_first_day'] && $is_mini === false)
 					echo '<span class="smalltext"> - <a href="', $scripturl, '?action=calendar;viewweek;year=', $calendar_data['current_year'], ';month=', $calendar_data['current_month'], ';day=', $day['day'], '">', $txt['calendar_week'], ' ', $week['number'], '</a></span>';
 
 				// Are there any holidays?
-				if (!empty($day['holidays']))
+				if (!empty($day['holidays']) && $is_mini === false)
 					echo '
-							<div class="smalltext holiday">', $txt['calendar_prompt'], ' ', implode(', ', $day['holidays']), '</div>';
+							<div class="smalltext holiday"><span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']), '</div>';
 
 				// Show any birthdays...
-				if (!empty($day['birthdays']))
+				if (!empty($day['birthdays']) && $is_mini === false)
 				{
 					echo '
 							<div class="smalltext">
@@ -360,7 +414,7 @@ function template_show_month_grid($grid_name)
 				}
 
 				// Any special posted events?
-				if (!empty($day['events']))
+				if (!empty($day['events']) && $is_mini === false)
 				{
 					echo '
 							<div class="smalltext lefttext">
@@ -387,10 +441,19 @@ function template_show_month_grid($grid_name)
 					echo '
 							</div>';
 				}
+				$current_month_started = $count;
+			}
+			elseif ($is_mini === false)
+			{
+				if ($current_month_started === false)
+					echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_prev']['current_year'], ';month=', $context['calendar_grid_prev']['current_month'], '">', $context['calendar_grid_prev']['last_of_month'] - $calendar_data['shift']-- + 1, '</a>';
+				else
+					echo '<a href="', $scripturl, '?action=calendar;year=', $context['calendar_grid_next']['current_year'], ';month=', $context['calendar_grid_next']['current_month'], '">', $current_month_started + 1 == $count ? (!empty($calendar_data['short_month_titles']) ? $txt['months_short'][$context['calendar_grid_next']['current_month']] . ' ' : $txt['months_titles'][$context['calendar_grid_next']['current_month']] . ' ') : '', $final_count++, '</a>';
 			}
 
 			echo '
 						</td>';
+			$count++;
 		}
 
 		echo '
@@ -404,7 +467,7 @@ function template_show_month_grid($grid_name)
 // Or show a weekly one?
 function template_show_week_grid($grid_name)
 {
-	global $context, $settings, $options, $txt, $scripturl, $modSettings;
+	global $context, $settings, $txt, $scripturl, $modSettings;
 
 	if (!isset($context['calendar_grid_' . $grid_name]))
 		return false;
@@ -416,96 +479,107 @@ function template_show_week_grid($grid_name)
 	{
 		echo '
 			<div class="cat_bar">
-				<h3 class="catbg weekly">';
-
-		if (empty($calendar_data['previous_calendar']['disabled']) && $calendar_data['show_next_prev'] && empty($done_title))
-			echo '
-					<span class="floatleft"><a href="', $calendar_data['previous_week']['href'], '">&#171;</a></span>';
-
-		if (empty($calendar_data['next_calendar']['disabled']) && $calendar_data['show_next_prev'] && empty($done_title))
-			echo '
-					<span class="floatright"><a href="', $calendar_data['next_week']['href'], '">&#187;</a></span>';
-
-		echo '
-					<a href="', $scripturl, '?action=calendar;month=', $month_data['current_month'], ';year=', $month_data['current_year'], '">', $txt['months_titles'][$month_data['current_month']], ' ', $month_data['current_year'], '</a>', empty($done_title) && !empty($calendar_data['week_number']) ? (' - ' . $txt['calendar_week'] . ' ' . $calendar_data['week_number']) : '', '
-				</h3>
-			</div>';
-
-		$done_title = true;
-
-		echo '
-				<ul class="weeklist">';
-
-		foreach ($month_data['days'] as $day)
-		{
-			echo '
-					<li class="windowbg">
-						<h4>';
-
-			// Should the day number be a link?
-			if (!empty($modSettings['cal_daysaslink']) && $context['can_post'])
-				echo '
-							<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>';
-			else
-				echo '
-							', $txt['days'][$day['day_of_week']], ' - ', $day['day'];
-
-			echo '
-						</h4>
-						<div class="', $day['is_today'] ? 'calendar_today' : 'windowbg2', ' weekdays">';
+				<h3 class="catbg">';
+				if (empty($done_title))
+				{
+					// Previous Week Link...
+					if (empty($calendar_data['previous_calendar']['disabled']) && !empty($calendar_data['show_next_prev']))
+					{
+						echo '
+							<span class="floatleft">
+								<a href="', $calendar_data['previous_week']['href'], '">&#171;</a>
+							</span>
+						';
+					}
 
-			// Are there any holidays?
-			if (!empty($day['holidays']))
-				echo '
-							<div class="smalltext holiday">', $txt['calendar_prompt'], ' ', implode(', ', $day['holidays']), '</div>';
+					// The Month Title + Week Number...
+					echo '<a href="', $scripturl, '?action=calendar;month=', $month_data['current_month'], ';year=', $month_data['current_year'], '">', $txt['months_titles'][$month_data['current_month']], ' ', $month_data['current_year'], '</a>', empty($done_title) && !empty($calendar_data['week_number']) ? (' - ' . $txt['calendar_week'] . ' ' . $calendar_data['week_number']) : '';
 
-			// Show any birthdays...
-			if (!empty($day['birthdays']))
-			{
-				echo '
-							<div class="smalltext">
-								<span class="birthday">', $txt['birthdays'], '</span>';
-
-				/* Each of the birthdays has:
-					id, name (person), age (if they have one set?), and is_last. (last in list?) */
-				foreach ($day['birthdays'] as $member)
-					echo '
-								<a href="', $scripturl, '?action=profile;u=', $member['id'], '"><span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '' : ', ';
-				echo '
-							</div>';
-			}
+					// Next Week Link...
+					if (empty($calendar_data['next_calendar']['disabled']) && !empty($calendar_data['show_next_prev']))
+					{
+						echo '
+							<span class="floatright">
+								<a href="', $calendar_data['next_week']['href'], '">&#187;</a>
+							</span>
+						';
+					}
 
-			// Any special posted events?
-			if (!empty($day['events']))
+					// If there's more than one month, which there "never is", let's not do this again...
+					$done_title = true;
+				}
+				echo '</h3>
+			</div>
+			<table class="table_grid" id="calendar_week">';
+			foreach ($month_data['days'] as $day)
 			{
-				echo '
-							<div class="smalltext">
-								<span class="event">', $txt['events'], '</span>';
-
-				/* The events are made up of:
-					title, href, is_last, can_edit (are they allowed to?), and modify_href. */
-				foreach ($day['events'] as $event)
+				// How should we be higlighted or otherwise not...?
+				$classes = array('days');
+				if (!empty($day['day']))
 				{
-					// If they can edit the event, show a star they can click on....
-					if ($event['can_edit'])
-						echo '
-								<a href="', $event['modify_href'], '"><img src="' . $settings['images_url'] . '/icons/calendar_modify.png" alt="*" /></a> ';
-
-					echo '
-								', $event['link'], $event['is_last'] ? '' : ', ';
+					$classes[] = $calendar_data['size'] == 'small' ? 'compact' : 'comfortable';
+					$classes[] = !empty($day['is_today']) ? 'calendar_today' : 'windowbg';
 				}
-
+				else
+					$classes[] = 'disabled';
 				echo '
-							</div>';
+					<tr class="days_wrapper">
+						<td class="', implode(' ', $classes), '">';
+						// Should the day number be a link?
+						if (!empty($modSettings['cal_daysaslink']) && !empty($context['can_post']))
+							echo '<a href="', $scripturl, '?action=calendar;sa=post;month=', $month_data['current_month'], ';year=', $month_data['current_year'], ';day=', $day['day'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['days'][$day['day_of_week']], ' - ', $day['day'], '</a>';
+						else
+							echo $txt['days'][$day['day_of_week']], ' - ', $day['day'];
+
+						// Are there any holidays?
+						if (!empty($day['holidays']))
+							echo '<span>', $txt['calendar_prompt'], '</span> ', implode(', ', $day['holidays']);
+
+						// Show any birthdays...
+						if (!empty($day['birthdays']))
+						{
+							echo '<span class="birthday">', $txt['birthdays'], '</span>';
+
+							/* Each of the birthdays has:
+								id, name (person), age (if they have one set?), and is_last. (last in list?) */
+							foreach ($day['birthdays'] as $member)
+							{
+								echo '
+									<a href="', $scripturl, '?action=profile;u=', $member['id'], '">
+										<span class="fix_rtl_names">', $member['name'], '</span>', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '
+									</a>
+								', $member['is_last'] ? '' : ', ';
+							}
+						}
+
+						// Any special posted events?
+						if (!empty($day['events']))
+						{
+							echo '<span class="event">', $txt['events'], '</span>';
+
+							/* The events are made up of:
+								title, href, is_last, can_edit (are they allowed to?), and modify_href. */
+							foreach ($day['events'] as $event)
+							{
+								// If they can edit the event, show a star they can click on....
+								if (!empty($event['can_edit']))
+								{
+									echo '
+										<a href="', $event['modify_href'], '">
+											<img src="' . $settings['images_url'] . '/icons/calendar_modify.png" alt="*" />
+										</a>
+									';
+								}
+								echo $event['link'], $event['is_last'] ? '' : ', ';
+							}
+						}
+
+						echo '</td>
+					</tr>
+				';
 			}
-
-			echo '
-						</div>
-					</li>';
-		}
-
-		echo '
-				</ul>';
+			echo '</table>
+		';
 	}
 }
 

+ 99 - 69
Themes/default/css/index.css

@@ -25,7 +25,7 @@ html {
 }
 /* Set a font-size that will look the same in all browsers. */
 body {
-	background: #E9EEF2;
+	background: #e9eef2;
 	/* Start with the best Vista/W7 font, then go to best Mac and Linux, then the old fallbacks.........*/
 	/* Font size is specifically chosen to be exactly 10 point. There are sound reasons for this (hinting, ClearType, etc). */
 	font: 83.33%/150% "Segoe UI", "Helvetica Neue", "Liberation Sans", "Nimbus Sans L", Arial, sans-serif;
@@ -622,8 +622,8 @@ div.pagesection div.floatright input, div.pagesection div.floatright select {
 	color: #078907;
 }
 
-.holiday {
-	color: #000080;
+.holiday > span {
+	color: rgb(0, 92, 255);
 }
 
 /* Colors for warnings */
@@ -1328,8 +1328,6 @@ img.sort {
 #wrapper, .frame {
 	margin: 0 auto;
 	min-width: 760px;
-	/* @todo Just trying this out. Methinks stuff gets too strung out on wide screens. */
-	max-width: 100em;
 }
 
 /* Box-shadow only on this one. */
@@ -3548,21 +3546,18 @@ dl.addrules dt.floatleft {
 }
 
 /* Used to indicate the current day in the grid. */
-.calendar_today {
+#main_grid .calendar_today span.day_text, #month_grid .calendar_today {
+	font-weight: bold;
+}
+.calendar_today, td.days:hover {
 	background: #fff;
-	border: 1px solid #bbb;
-	box-shadow: 0 2px 5px rgba(0,0,0,0.05) inset;
 }
 #month_grid {
-	padding: 0 15px 0 0;
-	width: 215px;
-	text-align: center;
+	width: 284px;
 	float: left;
-}
-#month_grid div.cat_bar {
-	border-radius: 5px 5px 0 0;
-	margin: 0 1px 0 0;
-	padding: 0 0 0 0;
+	text-align: center;
+	overflow: hidden;
+	margin-right: 1%;
 }
 #month_grid h3 a {
 	padding: 0 6px 0 6px;
@@ -3570,21 +3565,37 @@ dl.addrules dt.floatleft {
 #month_grid table {
 	width: 100%;
 	margin-bottom: 12px;
+	border-collapse: collapse;
+	background: #f0f4f7;
+	border: 1px solid #ccc;
 }
 #main_grid {
-	position: relative;
-	overflow: hidden;
+	overflow: auto;
 }
 #main_grid table {
 	width: 100%;
-	margin-bottom: 2px;
-	padding-bottom: 4px;
+	border-collapse: collapse;
+	background: #f0f4f7;
+	margin: 1px 0 0 0;
+	border: 1px solid #ccc;
+	overflow: auto;
+	-moz-box-sizing: border-box; box-sizing: border-box; -webkit-box-sizing: border-box;
 }
 #main_grid .cat_bar {
 	border-radius: 5px 5px 0 0;
 	margin: 0 1px;
 }
-#main_grid h3.catbg {
+#month_grid table th.days {
+	padding: 5px;
+	text-align: center;
+}
+#month_grid td.weeks {
+	font-size: large;
+}
+#month_grid td.weeks a:hover {
+	text-decoration: underline;
+}
+#month_grid h3.catbg, #main_grid h3.catbg {
 	padding: 8px 6px 4px 6px;
 }
 #main_grid h3.catbg span {
@@ -3594,7 +3605,8 @@ dl.addrules dt.floatleft {
 }
 #main_grid table th.days {
 	width: 14%;
-	padding: 4px 0;
+	padding: 10px;
+	text-align: left;
 }
 #main_grid table td.weeks {
 	text-align: center;
@@ -3604,49 +3616,53 @@ dl.addrules dt.floatleft {
 #main_grid table td.weeks a:hover {
 	text-decoration: none;
 }
-#main_grid table td.days {
-	vertical-align: top;
-	text-align: center;
+/* Main Highlighting */
+#main_grid table td.disabled, #month_grid table td.disabled {
+	background: #eee;
 }
-#main_grid h3.weekly {
-	text-align: center;
-	font-size: 1.4em;
+#main_grid table td.events, #month_grid table td.events {
+	background: rgba(30, 245, 20, 0.1);
 }
-#main_grid ul.weeklist, #main_grid ul.weeklist li {
-	margin: 0 0 8px 0;
-	padding: 0;
-	float: left;
-	width: 100%;
-	overflow: hidden;
+#main_grid table td.holidays, #month_grid table td.holidays {
+	background: rgba(23, 110, 245, 0.1);
 }
-#main_grid ul.weeklist li {
-	margin: 0 1px 0 1px;
-	border-top: 2px solid #fff;
+#main_grid table td.birthdays, #month_grid table td.birthdays {
+	background: rgba(102, 0, 255, 0.1);
 }
-#main_grid .weeklist h4 {
+/* Special Case Highlighting */
+#main_grid table td.events:hover, #month_grid table td.events:hover, #month_grid table td.calendar_today.events {
+	background: rgba(30, 245, 20, 0.2);
+}
+#main_grid table td.holidays:hover, #month_grid table td.holidays:hover, #month_grid table td.calendar_today.holidays {
+	background: rgba(23, 110, 245, 0.2);
+}
+#main_grid table td.birthdays:hover, #month_grid table td.birthdays:hover, #month_grid table td.calendar_today.birthdays {
+	background: rgba(153, 51, 255, 0.2);
+}
+#main_grid table td.days, #month_grid table td.days {
+	vertical-align: top;
+	text-align: left;
+	border-right: 1px solid #ccc;
+	border-bottom: 1px solid #ccc;
+}
+#main_grid table td.days {
+	padding: 10px;
+}
+#month_grid table td.days {
+	padding: 5px;
+	width: 14.28%;
 	text-align: center;
-	float: left;
-	width: 10em;
-	font-size: 1.2em;
-	padding: 15px 0;
 }
-#main_grid .weeklist h4 a:hover {
-	text-decoration: none;
-	border-bottom: 1px solid #346;
+#main_grid table tbody tr:nth-child(2) td.days, #month_grid table tbody tr:nth-child(2) {
+	border-top: 1px solid #ccc;
 }
-/* Use the old one true layout trick here. */
-#main_grid .weeklist .windowbg2 {
-	margin: 0 0 -95px 12em;
-	padding: 8px 8px 100px 8px;
-	border-radius: 0;
-	border-left: 2px solid #fff;
+#main_grid table tr.days_wrapper > td:nth-child(2), #month_grid table tr.days_wrapper > td:nth-child(2) {
+	border-left: 1px solid #ccc;
 }
-#main_grid .weeklist .calendar_today {
-	margin: 0 0 -95px 12em;
-	padding: 8px 8px 100px 8px;
-	border-left: none;
-	background: #fff;
+#main_grid table tr.days_wrapper:nth-child(2) > td.weeks {
+	border-top: 1px solid #ccc;
 }
+
 a.modify_event {
 	color: red;
 }
@@ -3655,27 +3671,41 @@ span.hidelink {
 }
 /* Add a background that fits with the calendar. */
 #calendar_navigation {
-	margin: -6px 1px 0 1px;
 	padding: 12px 0;
 	text-align: center;
-	float: left;
 	width: 100%;
 	background: #e7eaef;
 }
 /* Cheat and match this to the submit button. */
 #main_grid .buttonlist {
-	position: absolute;
-	bottom: 12px;
-	right: 12px;
+	margin: 6px 12px 0 0;
 }
-#main_grid .buttonlist a {
-	background: #cde7ff url(../images/theme/submit_bg.png) no-repeat;
-	border: 1px solid #aaa;
-	border-radius: 3px;
+
+#footer_cont {
+	margin-right: 1px;
+	border-right: 1px solid #ccc;
+	border-bottom: 1px solid #ccc;
+	border-left: 1px solid #ccc;
 }
-#main_grid .buttonlist a:hover {
-	background: #dceeff url(../images/theme/submit_bg.png) no-repeat 0 -140px;
-	color: #222;
+
+#month_grid .compact {
+	padding: 2px;
+}
+#month_grid .comfortable {
+	padding: 5px;
+}
+#main_grid .compact {
+	height: 45px;
+}
+#main_grid .comfortable {
+	height: 100px;
+	padding: 10px;
+}
+#calendar_week .compact {
+	height: 45px;
+}
+#calendar_week .comfortable {
+	padding: 10px;
 }
 
 /* Styles for the memberlist section.
@@ -3975,7 +4005,7 @@ span.hidelink {
 /* This lot will be simplified once I get all the styling hooks in place. */
 .generic_list_wrapper, .action_profile  #permissions, #postmodify .roundframe, .add_buddy, #creator .windowbg2,
 #notify_options .windowbg2, #info_center, #profileview, #messageindex, #mlist,
-#main_grid table, .core_posts, #recent .core_posts, #recent .topic_table, #searchform .roundframe {
+.core_posts, #recent .core_posts, #recent .topic_table, #searchform .roundframe {
 	background: #f0f4f7;
 	margin: 12px 0 0 0;
 	padding: 8px 8px 16px 8px;

+ 10 - 0
Themes/default/languages/Help.english.php

@@ -214,6 +214,16 @@ $helptxt['smileys'] = '<strong>Smiley Center</strong><br />
 $helptxt['calendar'] = '<strong>Manage Calendar</strong><br />
 	Here you can modify the current calendar settings as well as add and remove holidays that appear on the calendar.';
 $helptxt['cal_export'] = 'Exports a text file in the iCal format for importing in to other calendar applications';
+$helptxt['cal_highlight_events'] = 'This setting allows you to highlight events on the Mini Calendars, Main Calendar, both places, or disable event highlighting.';
+$helptxt['cal_highlight_holidays'] = 'This setting allows you to highlight holidays on the Mini Calendars, Main Calendar, both places, or disable event highlighting.';
+$helptxt['cal_highlight_birthdays'] = 'This setting allows you to highlight birthdays on the Mini Calendars, Main Calendar, both places, or disable event highlighting.';
+$helptxt['cal_disable_prev_next'] = 'If this setting is checked, the three month blocks on the left hand side of the page will be disabled.';
+$helptxt['cal_display_type'] = 'This setting allows you to change the display type of the calendar.<br /><br /><strong>Comfortable:</strong> makes the rows of the calendar big.<br /><strong>Compact:</strong> makes the rows of the calendar small.';
+$helptxt['cal_week_links'] = 'If this setting is checked, links will be added alongside each week in the calendar.';
+$helptxt['cal_prev_next_links'] = 'If this setting is checked, previous month and next month links will be added to the top of each month for easy navigation.';
+$helptxt['cal_short_months'] = 'If this setting is checked, month names within the calendar will be shortened.<br /><br /><strong>Enabled:</strong> ' . $txt['months_short'][1] . ' 1<br /><strong>Disabled:</strong> ' . $txt['months_titles'][1] . ' 1';
+$helptxt['cal_short_days'] = 'If this setting is checked, day names within the calendar will be shortened.<br /><br /><strong>Enabled:</strong> ' . $txt['days_short'][1] . '<br /><strong>Disbaled:</strong> ' . $txt['days'][1];
+$helptxt['cal_week_numbers'] = 'If this setting is checked, the first day of every week will have the week number next to that day.<br /><br /><strong>Enabled:</strong> March 3 - Week 10</strong><br /><strong>Disabled:</strong> March 3';
 
 $helptxt['serversettings'] = '<strong>Server Settings</strong><br />
 	Here you can perform the core configuration for your forum. This section includes the database and url settings, as well as other

+ 27 - 0
Themes/default/languages/ManageCalendar.english.php

@@ -29,6 +29,33 @@ $txt['setting_cal_allowspan'] = 'Allow events to span multiple days';
 $txt['setting_cal_maxspan'] = 'Max number of days an event can span';
 $txt['setting_cal_showInTopic'] = 'Show linked events in topic display';
 
+$txt['setting_cal_display_type'] = 'Cell Display Type';
+$txt['setting_cal_display_comfortable'] = 'Comfortable';
+$txt['setting_cal_display_compact'] = 'Compact';
+
+$txt['setting_cal_disable_prev_next'] = 'Disable Three Month Blocks';
+
+$txt['setting_cal_highlight_events'] = 'Highlight Events';
+$txt['setting_cal_highlight_holidays'] = 'Highlight Holidays';
+$txt['setting_cal_highlight_birthdays'] = 'Highlight Birthdays';
+
+$txt['setting_cal_highlight_none'] = 'Nowhere';
+$txt['setting_cal_highlight_mini'] = 'Mini Calendars Only';
+$txt['setting_cal_highlight_main'] = 'Main Calendar Only';
+$txt['setting_cal_highlight_both'] = 'Mini &amp; Main Calendars';
+
+$txt['setting_cal_week_links'] = 'Show Week Links';
+$txt['setting_cal_week_links_none'] = 'Nowhere';
+$txt['setting_cal_week_links_mini'] = 'Mini Calendars Only';
+$txt['setting_cal_week_links_main'] = 'Main Calendar Only';
+$txt['setting_cal_week_links_both'] = 'Mini &amp; Main Calendars';
+$txt['setting_cal_prev_next_links'] = 'Show <em>Previous / Next</em> Month Links';
+
+// The name of this setting is kind of misleading...we can't shorten actual months unfortunately!
+$txt['setting_cal_short_months'] = 'Short Month Titles';
+$txt['setting_cal_short_days'] = 'Short Day Titles';
+$txt['setting_cal_week_numbers'] = 'Show Week Numbers';
+
 // Adding/Editing/Viewing Holidays
 $txt['manage_holidays_desc'] = 'From here you can add and remove holidays from your forum calendar.';
 $txt['current_holidays'] = 'Current Holidays';

+ 6 - 0
Themes/default/languages/index.english.php

@@ -21,13 +21,19 @@ $txt['lang_capitalize_dates'] = true;
 // Number format.
 $txt['number_format'] = '1,234.00';
 
+$txt['days_title'] = 'Days';
 $txt['days'] = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
 $txt['days_short'] = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
 // Months must start with 1 => 'January'. (or translated, of course.)
+$txt['months_title'] = 'Months';
 $txt['months'] = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
 $txt['months_titles'] = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
 $txt['months_short'] = array(1 => 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
 
+$txt['minutes_label'] = 'Minutes';
+$txt['hours_label'] = 'Hours';
+$txt['years_title'] = 'Years';
+
 $txt['time_am'] = 'am';
 $txt['time_pm'] = 'pm';