Skip to content

Commit

Permalink
ENHANCEMENT: Add CSS styling for compliance with Simple theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Uncle Cheese committed Aug 22, 2012
2 parents ad0ecc6 + 70bc4b4 commit 5525eba
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 24 deletions.
41 changes: 28 additions & 13 deletions code/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class Calendar extends Page {
static $language = "EN";



static $jquery_included = false;


Expand All @@ -88,7 +87,6 @@ public static function set_jquery_included($bool = true) {




public function getCMSFields()
{

Expand Down Expand Up @@ -174,7 +172,8 @@ public function getDateToEventRelation() {



public function getEventList($start, $end, $filter = null, $limit = null) {
public function getEventList($start, $end, $filter = null, $limit = null, $announcement_filter = null) {

foreach($this->getAllCalendars() as $calendar) {
$eventList = new ArrayList();
if($events = $calendar->getStandardEvents($start, $end, $filter)) {
Expand All @@ -188,7 +187,7 @@ public function getEventList($start, $end, $filter = null, $limit = null) {
(EndDate BETWEEN '$start' AND '$end')
");
if($filter) {
$announcements->filter($filter);
$announcements->where($announcement_filter);
}

if($announcements) {
Expand Down Expand Up @@ -258,7 +257,7 @@ protected function getRecurringEvents($filter = null) {
->filter("ParentID", $this->ID)
->innerJoin($datetime_class, "\"{$datetime_class}\".{$relation} = \"SiteTree\".ID");
if($filter) {
$events->filter($filter);
$events->where($filter);
}
return $events;
}
Expand Down Expand Up @@ -402,8 +401,6 @@ public function MonthJumpForm() {
return $c->MonthJumpForm();
}




}

Expand Down Expand Up @@ -442,7 +439,9 @@ public function init() {
parent::init();
RSSFeed::linkToFeed($this->Link() . "rss", $this->RSSTitle ? $this->RSSTitle : $this->Title);
Requirements::themedCSS('calendar','event_calendar');
Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js');
if(!Calendar::$jquery_included) {
Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js');
}
Requirements::javascript('event_calendar/javascript/calendar.js');
}

Expand Down Expand Up @@ -543,7 +542,7 @@ public function respond() {
public function index(SS_HTTPRequest $r) {
switch($this->DefaultView) {
case "month":
return Director::redirect($this->Link('show/month'));
return $this->redirect($this->Link('show/month'));
break;

case "week":
Expand Down Expand Up @@ -754,7 +753,7 @@ public function ics(SS_HTTPRequest $r) {
return $result;
}
else {
Director::redirectBack();
$this->redirectBack();
}
}

Expand Down Expand Up @@ -798,9 +797,20 @@ public function parseURL(SS_HTTPRequest $r) {


public function Events() {
$event_filter = null;
$announcement_filter = null;
if($search = $this->getRequest()->getVar('s')) {
$s = Convert::raw2sql($search);
$event_filter = "\"SiteTree\".Title LIKE '%$s%' OR \"SiteTree\".Content LIKE '%$s%'";
$announcement_filter = "\"CalendarAnnouncement\".Title LIKE '%$s%' OR \"CalendarAnnouncement\".Content LIKE '%$s%'";
$this->SearchQuery = $search;
}
$all = $this->data()->getEventList(
$this->startDate->dump(),
$this->endDate->dump()
$this->endDate->dump(),
$event_filter,
null,
$announcement_filter
);
$list = $all->limit($this->EventsPerPage, $this->getOffset());
$next = $this->getOffset()+$this->EventsPerPage;
Expand Down Expand Up @@ -930,7 +940,8 @@ public function MonthJumpForm() {
$range = range(($dummy->subtractYear(3)->format('Y')), ($dummy->addYear(6)->format('Y')));
$year_map = array_combine($range, $range);
$f = new Form(
Controller::curr(),
$this,

"MonthJumpForm",
new FieldList (
$m = new DropdownField('Month','', CalendarUtil::get_months_map('%B')),
Expand All @@ -945,11 +956,15 @@ public function MonthJumpForm() {
$m->setValue($this->startDate->format('m'));
$y->setValue($this->startDate->format('Y'));
}
else {
$m->setValue(date('m'));
$y->setValue(date('Y'));
}
return $f;
}

public function doMonthJump($data, $form) {
return Director::redirect($this->Link('show').'/'.$data['Year'].$data['Month']);
return $this->redirect($this->Link('show').'/'.$data['Year'].$data['Month']);
}


Expand Down
4 changes: 3 additions & 1 deletion css/calendar.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

.event-calendar-events ul, .event-calendar-events ul li { list-style:none; margin:0; padding:0; }

.event-calendar-events > ul { border-top:1px solid #ccc; }
Expand All @@ -8,4 +9,5 @@
.event-calendar-other-dates ul, .event-calendar-other-dates ul li { list-style:none; margin:0; padding:0; }
.event-calendar-other-dates h4 { margin:0; }

.vevent .dates { font-weight:700; }
.vevent .dates { font-weight:700; }

1 change: 1 addition & 0 deletions css/calendar_cms.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#Form_EditForm_RecurringDaysOfWeek { width:400px; }
#Form_EditForm_RecurringDaysOfMonth { width:360px; }
#Form_EditForm_RecurringDaysOfWeek li, #Form_EditForm_RecurringDaysOfMonth li { float:left; padding:2px 9px; }
Expand Down
3 changes: 2 additions & 1 deletion css/calendar_widget.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

.calendar-widget { margin:0 0 2em; }
.calendar-widget table { width:100%; border-collapse:collapse; border:1px solid #ddd; border-spacing:0; margin:0; }
.calendar-widget table td, .calendar-widget table th { border:1px solid #ddd; }
Expand All @@ -12,4 +13,4 @@
.calendar-widget tbody .show-week { width:9%; text-align:center; }
.calendar-widget tbody .calendar-day:hover, .calendar-widget tbody .show-week:hover, .calendar-widget tbody .selected { background-color:#d9edf7; cursor:pointer; color:#3a87ad; }
.calendar-widget tbody .out-of-month { background-color:#eee; color:#999; }
.calendar-widget tbody .today { font-weight:700; color:#3a87ad; }
.calendar-widget tbody .today { font-weight:700; color:#3a87ad; }
9 changes: 4 additions & 5 deletions javascript/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ $(function() {

/*
$(window).scroll(function() {
if ($(window).scrollTop() >= ($(document).height() - $(window).height())) {
if ($('.calendar-view-more').length && !fetching) {
if($('.calendar-view-more').length && !fetching) {
var offset = $('.calendar-view-more').offset();
if($(window).scrollTop()+$(window).height() >= offset.top) {
$('.calendar-view-more').click();
}
}
}
});
*/

});

})(jQuery);
10 changes: 10 additions & 0 deletions javascript/calendar_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,15 @@
var monthName = this.settings.calMonthsLabels[this.month]
var html = '<table class="calendar-widget-table">';
html += '<thead>';
<<<<<<< HEAD
html += '<tr><th colspan="8"><a class="prev" href="javascript:void(0);"> &laquo; </a>';
html += '<a href="javascript:void(0);" class="show-month">'+monthName + "&nbsp;" + this.year + '</a>';
html += '<a class="next" href="javascript:void(0);"> &raquo; </a></th></tr>';
=======
html += '<tr><th colspan="8"><a class="prev" href="javascript:void(0);"> << </a>';
html += '<a href="javascript:void(0);" class="show-month">'+monthName + "&nbsp;" + this.year + '</a>';
html += '<a class="next" href="javascript:void(0);"> >> </a></th></tr>';
>>>>>>> bidstuff
html += '</thead>';
html += '<tbody>';
html += '<tr class="calendar-header">';
Expand Down Expand Up @@ -204,7 +210,11 @@
cell++;

}
<<<<<<< HEAD
html += "<td class='show-week'>&laquo;</td>";
=======
html += "<td class='show-week'>&lt;&lt;</td>";
>>>>>>> bidstuff
html += '</tr><tr>';
}
html += '</tr></tbody></table>';
Expand Down
2 changes: 1 addition & 1 deletion templates/CalendarWidget.ss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<% require javascript(event_calendar/javascript/calendar_core.js) %>
<% require javascript(event_calendar/javascript/calendar_widget.js) %>
<% require css(event_calendar/css/calendar_widget.css) %>
<div><img src="/framework/thirdparty/greybox/indicator.gif" alt="loading" /></div>
<div><img src="framework/thirdparty/greybox/indicator.gif" alt="loading" /></div>
4 changes: 1 addition & 3 deletions templates/Includes/EventList.ss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<ul>
<% loop Events %>
<li class="vevent clearfix">
Expand All @@ -25,5 +24,4 @@
</ul>
<% if MoreEvents %>
<a href="$MoreLink" class="calendar-view-more"><% _t('Calendar.VIEWMOREEVENTS','View more...') %></a>
<% end_if %>

<% end_if %>
1 change: 1 addition & 0 deletions templates/Layout/Calendar.ss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

<h2>$Title</h2>
<p class="feed"><a href="$Link(rss)"><% _t('SUBSCRIBE','Calendar RSS Feed') %></a></p>
$Content
Expand Down

0 comments on commit 5525eba

Please sign in to comment.