Skip to content

Commit

Permalink
link displayed events to their pages
Browse files Browse the repository at this point in the history
  • Loading branch information
serpent213 committed Feb 8, 2014
1 parent 24e3bee commit 6cfd008
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
23 changes: 2 additions & 21 deletions EventCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@
'remoteExtPath' => 'yasec/resources'
);

/*
$wgHooks['BeforePageDisplay'][] = 'wfEventCalendarOnBeforePageDisplay';
function wfEventCalendarOnBeforePageDisplay(&$out, &$skin) {
$out->addModules('ext.yasec');
}
*/

// Configuration variables

// How long to cache pages using DPL's in seconds. Default to 1 day. Set to
Expand Down Expand Up @@ -150,8 +142,6 @@ function renderEventCalendar( $input, $args, $mwParser ) {
$where['page_namespace'] = $namespaceIndex;
$where[] = "page_title REGEXP '^[0-9]{4}/[0-9]{2}/[0-9]{2}_[[:alnum:]]'";

// TODO rename Events to Event

$options['ORDER BY'] = 'page_title DESC';
$options['LIMIT'] = 5000; // should limit output volume to about 300 KiB
// assuming 60 bytes per entry
Expand All @@ -163,6 +153,7 @@ function renderEventCalendar( $input, $args, $mwParser ) {
foreach ( $res as $row ) {
$date = str_replace( '/', '-', substr( $row->page_title, 0, 10 ));
$title = str_replace( '_', ' ', substr( $row->page_title, 11 ));
$url = Title::makeTitle( $namespaceIndex, $row->page_title )->getLinkURL();

if ( !array_key_exists( $title, $eventmap )) {
$eventmap[$title] = array();
Expand All @@ -189,6 +180,7 @@ function renderEventCalendar( $input, $args, $mwParser ) {
'title' => $title,
'start' => $date,
'end' => $enddate,
'url' => $url,
);
}

Expand All @@ -204,21 +196,10 @@ function renderEventCalendar( $input, $args, $mwParser ) {
"if (!window.eventCalendarData) { window.eventCalendarData = []; }\n" .
"window.eventCalendarData.push(";

// process results of query, outputting a JS data structure
/*
foreach ( $res as $row ) {
$date = str_replace( '/', '-', substr( $row->page_title, 0, 10 ));
$title = str_replace( '_', ' ', substr( $row->page_title, 11 ));
$output .= "{ title: '{$title}', start: '{$date}' },";
}
*/

$output .= json_encode( $events );

// end array push
$output .= ");\n" .
"/* eventmap: " . json_encode( $eventmap ) . " */\n" .
"/* events: " . json_encode( $events ) . " */\n" .
"</script>\n";

return array( $output, 'markerType' => 'nowiki' );
Expand Down
4 changes: 4 additions & 0 deletions resources/ext.yasec.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ div.fc {
.fc h2 {
border-bottom: none;
}

.fc .fc-event-container a, .fc .fc-event-container a:hover, .fc .fc-event-container a:visited {
color: white;
}

0 comments on commit 6cfd008

Please sign in to comment.