Skip to content

Commit

Permalink
ENHANCEMENT: Added CSS for compliancy 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 20aa885 + 7fde5b3 commit ad0ecc6
Show file tree
Hide file tree
Showing 13 changed files with 138 additions and 321 deletions.
39 changes: 12 additions & 27 deletions code/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class Calendar extends Page {
static $language = "EN";



static $jquery_included = false;


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



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

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


public function MonthJumpForm() {
$controller = Controller::curr();
if($controller->class == "Calendar_Controller" || is_subclass_of($controller, "Calendar_Controller")) {
Expand Down Expand Up @@ -439,10 +441,8 @@ class Calendar_Controller extends Page_Controller {
public function init() {
parent::init();
RSSFeed::linkToFeed($this->Link() . "rss", $this->RSSTitle ? $this->RSSTitle : $this->Title);
Requirements::themedCSS('calendar.css');
if(!Calendar::$jquery_included) {
Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js');
}
Requirements::themedCSS('calendar','event_calendar');
Requirements::javascript(THIRDPARTY_DIR.'/jquery/jquery.js');
Requirements::javascript('event_calendar/javascript/calendar.js');
}

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

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

Expand Down Expand Up @@ -798,20 +798,9 @@ 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(),
$event_filter,
null,
$announcement_filter
$this->endDate->dump()
);
$list = $all->limit($this->EventsPerPage, $this->getOffset());
$next = $this->getOffset()+$this->EventsPerPage;
Expand Down Expand Up @@ -941,7 +930,7 @@ public function MonthJumpForm() {
$range = range(($dummy->subtractYear(3)->format('Y')), ($dummy->addYear(6)->format('Y')));
$year_map = array_combine($range, $range);
$f = new Form(
$this,
Controller::curr(),
"MonthJumpForm",
new FieldList (
$m = new DropdownField('Month','', CalendarUtil::get_months_map('%B')),
Expand All @@ -956,15 +945,11 @@ 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 $this->redirect($this->Link('show').'/'.$data['Year'].$data['Month']);
return Director::redirect($this->Link('show').'/'.$data['Year'].$data['Month']);
}


Expand Down
2 changes: 1 addition & 1 deletion code/CalendarEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class CalendarEvent_Controller extends Page_Controller {

public function init() {
parent::init();
Requirements::css('event_calendar/css/calendar.css');
Requirements::themedCSS('calendar','event_calendar');
}


Expand Down
119 changes: 7 additions & 112 deletions css/calendar.css
Original file line number Diff line number Diff line change
@@ -1,116 +1,11 @@
.calendar-view-more {display:block;text-indent:-9999em;}
.calendar-view-more.loading {background:url(../images/loader.gif) no-repeat;text-indent:-9999em;}
.calendar-quick-nav li {display:inline;}
.calendar-quick-nav li a.current {background: #ddd};
.event-calendar-events ul, .event-calendar-events ul li { list-style:none; margin:0; padding:0; }

/* [YYYY]-[MM]-[DD]T[hh]:[mm]-[hh] */
.event-calendar-events > ul { border-top:1px solid #ccc; }

/*Button styling
===============================*/
.event-calendar-events .vevent { padding:0 0 1em; margin:0 0 1em; border-bottom:1px solid #ccc; }

a.btn { display:block; padding:4px; color:#fff; background:#225eaf; border:1px solid #dedede; font-size:9px;
text-transform:uppercase; text-align:center; text-decoration:none; }
a.btn:hover { color:#fff; background:#6a6a6a; border:1px solid #dedede; }
.event-calendar-other-dates { margin:1em 0 0; }
.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; }

a.add { width:16px; height:16px; background:transparent url(../images/calendar__plus.png) 0 0 no-repeat; padding:0; border:0; text-indent:-9999em; }
a.add:hover { background:transparent url(../images/calendar__plus.png) 0 0 no-repeat; border:0; }

/*Top Heading
===============================*/
#topHeading { border-bottom:3px solid #6a6a6a; padding:12px 0 4px 0; }
#topHeading h2 {clear:both;}
#topHeading span { display:block; margin-top:12px;float:left; }
#topHeading span.feed { padding:3px 0 3px 20px;float:right; background:transparent url('../images/feed.png') left top no-repeat; }

/*Date Heading*/
#dateHeader {text-align:center; margin:8px 0 ; padding: 18px 0 16px 0; border-top:3px double #D4D4D4; border-bottom:3px double #D4D4D4;}
#dateHeader h3 {line-height: 0; margin: 0; padding:0;}

/*Month Navs
==============================*/
#monthNav { text-align:center; background: #dedede; padding:8px 0; margin:10px 0 22px; }
#monthNav a { width:20px;}
#monthNav h2 {cursor:pointer;}
#monthNav h2:hover {color:#aaa;}
#monthNav a:hover { }
#monthNav a.prev { float:left; }
#monthNav a.next { float:right; }
#monthNav h3 { padding:0; margin:0; font-size:18px; }

#monthSelect { background:#dedede; border:2px solid #c4c4c4; text-align:center; padding:10px; margin-top:10px; }
#monthSelect select { width:100%; }

/*Sort and View Type
==============================*/
#calView { border-bottom: 2px solid #dedede; }
#calView ul { display:inline; float:left; margin:8px 0 0 140px; }
#calView ul li { display:inline; margin:0; }
#calView ul li span { float:left; margin-right:8px; padding-bottom:6px; }

#calView ul li a { float:left; padding-bottom:3px; margin-left:5px; text-decoration:none; }
#calView ul li a:hover, #calView ul li a.active { border-bottom:3px solid #666; text-decoration:none; }
#calView ul li a:hover { border-color:#aaa; }

#calView ul li.more a, #calView ul li.less a { display:block; text-decoration:none; padding:0 0 3px; margin:0 5px 0 0; }
#calView ul li.more a.open, #calView ul li.less a.open { border-bottom:3px solid #666; }
#calView ul li span {font-weight:700;}
#calView h5 {float:right; display: inline; margin:7px 8px 0 0; padding: 0;}

/*Event Summary (single date)
==============================*/
.vevent { border-bottom: 1px solid #dedede; padding:10px 0; }

.vevent div.dates, .vevent div.details { float:left; }
.vevent ul.utility { float:right; }
.vevent div.dates { width:20%; margin-right:15px; }
.vevent div.details { width:54%; margin-right:0; padding-left:15px; border-left:1px solid #dedede; }
.vevent ul.utility { width:100px; margin:0; list-style:none; }
.vevent ul.utility li { list-style:none; margin:0 0 5px; }

.vevent dl.more-dates { margin:10px 0 0; }
.vevent dl.more-dates dt { font-weight:700; }

.vevent .summary { margin:0 0 5px; }
.vevent .location { text-transform:uppercase; font-size:11px; }
.vevent .description { margin:5px 0; clear:both; }

.vevent .dtstart { display:inline; font-weight:700; text-transform:uppercase; border:0; margin:0 0 10px; }
.vevent .dtend { display:inline; font-weight:700; border:0; }
.vevent h5 span.dtstart, .vevent h5 span.dtend {display: inline;}

.vevent dt span.dtstart, .vevent dt span.dtend { display:inline; }

.vevent dl, .vevent dt, .vevent dd { margin:0; }
.vevent dt { font-weight:700; clear:both; float:left; margin-bottom:4px; }
.vevent dd { float:left; }
.vevent h4.dates { font-size:12px; margin:5px 0; border-bottom:1px solid #ccc; width:30%; }

.vevent #eventImage img { float:right; }

/* Event Detail with Image*/
#eventImage { padding:5px; }

#Form_CalendarFilterForm {padding:0 10px;}
#Form_CalendarFilterForm fieldset {border:0;}
#Form_CalendarFilterForm div.field {padding:5px 0;}
#Form_CalendarFilterForm div.middleColumn {background:none;margin:0;padding:0;}
#Form_CalendarFilterForm label {display:block;margin:0;}
#Form_CalendarFilterForm div.field {width:216px;text-align:left;}
#Form_CalendarFilterForm select {width:auto;clear:both;}
#Form_CalendarFilterForm option {width:auto;padding:0 5px;}
#Form_CalendarFilterForm div.Actions {margin:0;text-align:left;}
#Form_CalendarFilterForm div.fieldgroup select {font-size:12px;font-weight:normal;}

#StartMonthStartDayStartYear div.fieldgroupField,
#StartDayStartMonthStartYear div.fieldgroupField {display:inline;}
#EndMonthEndDayEndYear div.fieldgroupField,
#EndDayEndMonthEndYear div.fieldgroupField {display:inline;}
#Form_CalendarFilterForm div.fieldgroup label {display:block;width:200px;border-bottom:1px solid #aaa;margin-bottom:5px;}

/* clearfix */
.clearfix:after {content: "."; display: block; height: 0; clear: both; visibility: hidden;}
.clearfix {display: inline-block;}
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;}
/* End hide from IE-mac */
.vevent .dates { font-weight:700; }
55 changes: 15 additions & 40 deletions css/calendar_cms.css
Original file line number Diff line number Diff line change
@@ -1,46 +1,21 @@
#Form_EditForm_RecurringDaysOfWeek {width:400px;}
#Form_EditForm_RecurringDaysOfMonth {width:360px;}
#Form_EditForm_WeeklyInterval_Wrapper .field,
#Form_EditForm_MonthlyInterval_Wrapper .field {}
#Form_EditForm_RecurringDaysOfWeek li,
#Form_EditForm_RecurringDaysOfMonth li {
float:left;
padding:2px 9px;
}
#Form_EditForm_RecurringDaysOfWeek li:hover,
#Form_EditForm_RecurringDaysOfMonth li:hover {
background:#ccc;
}
#Form_EditForm_RecurringDaysOfWeek { width:400px; }
#Form_EditForm_RecurringDaysOfMonth { width:360px; }
#Form_EditForm_RecurringDaysOfWeek li, #Form_EditForm_RecurringDaysOfMonth li { float:left; padding:2px 9px; }
#Form_EditForm_RecurringDaysOfWeek li:hover, #Form_EditForm_RecurringDaysOfMonth li:hover { background:#ccc; }

div#RecurringDaysOfMonth div.middleColumn,
div#RecurringDaysOfWeek div.middleColumn,
div#RecurringDaysOfMonth span.middleColumn,
div#RecurringDaysOfWeek span.middleColumn {
overflow:hidden;
}
#RecurringDaysOfMonth div.middleColumn, #RecurringDaysOfWeek div.middleColumn, #RecurringDaysOfMonth span.middleColumn, #RecurringDaysOfWeek span.middleColumn { overflow:hidden; }

div#RecurringDaysOfMonth .optionset li,
div#RecurringDaysOfWeek .optionset li
{width:50px;padding:0;margin:0;height:50px;font-weight:bold;padding-top:0px;}
#RecurringDaysOfMonth .optionset li, #RecurringDaysOfWeek .optionset li { width:50px; padding:0; margin:0; height:50px; font-weight:bold; padding-top:0px; }

#RecurringDaysOfMonth .optionset li label, #RecurringDaysOfWeek .optionset li label { display:block; height:30px; font-size:16px; margin-top:0; text-align:center; padding-top:20px; }
#RecurringDaysOfMonth .optionset li input, #RecurringDaysOfWeek .optionset li input { float:left; }

div#RecurringDaysOfMonth .optionset li label,
div#RecurringDaysOfWeek .optionset li label {display:block;height:30px;font-size:16px;margin-top:0;text-align:center;padding-top:20px;}
div#RecurringDaysOfMonth .optionset li input,
div#RecurringDaysOfWeek .optionset li input {float:left;}
#RecurringDaysOfWeek .optionset li { border-bottom:1px solid #666; }
#RecurringDaysOfMonth .optionset li.selected, #RecurringDaysOfWeek .optionset li.selected { background:#aaa; }

div#RecurringDaysOfWeek .optionset li {border-bottom:1px solid #666;}
div#RecurringDaysOfMonth .optionset li.selected,
div#RecurringDaysOfWeek .optionset li.selected {background:#aaa;}
#RecurringDaysOfMonth .optionset li.b-btm, #RecurringDaysOfWeek .optionset li.b-btm { border-bottom:1px solid #666; }
#RecurringDaysOfMonth .optionset li.b-top, #RecurringDaysOfWeek .optionset li.b-top { border-top:1px solid #666; }
#RecurringDaysOfMonth .optionset li.b-lft, #RecurringDaysOfWeek .optionset li.b-lft { border-left:1px solid #666; }
#RecurringDaysOfMonth .optionset li.b-rgt, #RecurringDaysOfWeek .optionset li.b-rgt { border-right:1px solid #666; }

#RecurringDaysOfMonth .optionset li.b-btm,
#RecurringDaysOfWeek .optionset li.b-btm {border-bottom:1px solid #666;}
#RecurringDaysOfMonth .optionset li.b-top,
#RecurringDaysOfWeek .optionset li.b-top {border-top:1px solid #666;}
#RecurringDaysOfMonth .optionset li.b-lft,
#RecurringDaysOfWeek .optionset li.b-lft {border-left:1px solid #666;}
#RecurringDaysOfMonth .optionset li.b-rgt,
#RecurringDaysOfWeek .optionset li.b-rgt {border-right:1px solid #666;}
>>>>>>> 0a62761d67c1852b2f28b77bf7a72e8a611dea1a

#Repeat_Alert_Message {background: #fff3a7;padding:2px 4px;border-top:1px solid #d3af22;border-bottom:1px solid #d3af22;}
#Repeat_Alert_Message { background:#fff3a7; padding:2px 4px; border-top:1px solid #d3af22; border-bottom:1px solid #d3af22; }
21 changes: 12 additions & 9 deletions css/calendar_widget.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
table.calendar-widget-table td.calendar-day,
table.calendar-widget-table td.show-week {cursor: pointer;}
table.calendar-widget-table td.calendar-day:hover,
table.calendar-widget-table td.show-week:hover {background-color:#ccc;}
table.calendar-widget-table td.calendar-day.selected {background-color:#aaa;}
.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; }

table.calendar-widget-table td.out-of-month {color:#999;background-color::#999;}
table.calendar-widget-table td.today {border-bottom: 2px solid rgb(158, 0, 0);}
table.calendar-widget-table td.hasEvent {background-image:url(../images/dot.png);background-position:center;background-repeat: no-repeat;}
.calendar-widget thead th { text-align:center; padding:5px; font-size:1.2em; }

table.calendar-widget-table thead th {text-align:center;}
.calendar-widget tbody td { background-color:#fff; padding:4px; width:13%; font-size:1em; }

.calendar-widget tbody .calendar-header td { background-color:#555; color:#fff; border-color:#555; }

.calendar-widget tbody .calendar-day { text-align:right; }
.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; }
8 changes: 4 additions & 4 deletions javascript/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ $(function() {

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

});
Expand Down
6 changes: 3 additions & 3 deletions javascript/calendar_widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@
var monthName = this.settings.calMonthsLabels[this.month]
var html = '<table class="calendar-widget-table">';
html += '<thead>';
html += '<tr><th colspan="8"><a class="prev" href="javascript:void(0);"> << </a>';
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);"> >> </a></th></tr>';
html += '<a class="next" href="javascript:void(0);"> &raquo; </a></th></tr>';
html += '</thead>';
html += '<tbody>';
html += '<tr class="calendar-header">';
Expand Down Expand Up @@ -204,7 +204,7 @@
cell++;

}
html += "<td class='show-week'>&lt;&lt;</td>";
html += "<td class='show-week'>&laquo;</td>";
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 id="calendar-widget"><img src="/sapphire/thirdparty/greybox/indicator.gif" alt="loading" /></div>
<div><img src="/framework/thirdparty/greybox/indicator.gif" alt="loading" /></div>
Loading

0 comments on commit ad0ecc6

Please sign in to comment.