Made a kind of solution for the 'add all day checkbox to date' and 'click on calendar to create event' issues related to the http://drupal.org/node/235662 , http://drupal.org/node/145205 , http://drupal.org/node/22741 and http://drupal.org/node/6922 .
The 'Date all day' module is based on the Date All day Drupal 5.x module code originally posted by by mcneelycorp ( http://drupal.org/user/49666 ) and Moshe Weitzman ( http://drupal.org/user/23 ) from Vito ( http://drupal.org/user/161393 ) - v.0.1 and is at the http://vito.ho.ua/download .
Unfortunately got no solution for Event, so tried the Calendar and found a solution for it. This post probably needs to be moved to some Calendar-related topic.
So just added the module for event creation from Calendar. The original comment is at the http://drupal.org/node/235662#comment-1212417 .
The following code is needed in the theme to add a create event link to the month and day view:
/**
* Format an date's day box in a calendar
*
* @param date
* The day to display in YYYY-MM-DD format.
* @param view
* The view being displayed.
* @param items
* The list of all items in the current view.
* @param params
* An array of paramters.
* @param selected
* Whether the current date has nodes.
* @return
* A themed day.
*/
function themename_calendar_date_box($date, $view, $items, $params, $selected = FALSE) {
$add_link = '';
if($view->calendar_type != 'year') {
$add_link = '<div class="day addevent">'. l('+', 'node/add/event/'. str_replace('-', '/', $date)) .'</div>'."\n";
}
return theme_calendar_date_box($date, $view, $items, $params, $selected). $add_link;
}Also you may add the addevent CSS class to the site's stylesheet and theme it to look similar to the rest of date parts:
.addevent {
border-style: solid none solid solid !important;
border-width: 1px !important;
border-color: #CCCCCC !important;
}
- vito's blog
- Login or register to post comments
- Русский
Hi, this is a great feature,
Hi, this is a great feature, why don't you create a regular separate module on drupal site?