Make basic calendar printing work
This commit is contained in:
parent
af4b9439d0
commit
3117b519ac
12 changed files with 431 additions and 425 deletions
|
@ -29,6 +29,7 @@ class calendar extends rcube_plugin
|
|||
public $rc;
|
||||
public $driver;
|
||||
public $home; // declare public to be used in other classes
|
||||
public $urlbase;
|
||||
public $timezone;
|
||||
|
||||
public $ical;
|
||||
|
@ -66,7 +67,7 @@ class calendar extends rcube_plugin
|
|||
$this->load_config();
|
||||
|
||||
// load localizations
|
||||
$this->add_texts('localization/', $this->rc->task == 'calendar' && !$this->rc->action);
|
||||
$this->add_texts('localization/', $this->rc->task == 'calendar' && (!$this->rc->action || $this->rc->action == 'print'));
|
||||
|
||||
// set user's timezone
|
||||
if ($this->rc->config->get('timezone') === 'auto')
|
||||
|
@ -87,9 +88,6 @@ class calendar extends rcube_plugin
|
|||
|
||||
// settings are required in every GUI step
|
||||
$this->rc->output->set_env('calendar_settings', $this->load_settings());
|
||||
|
||||
$skin = $this->rc->config->get('skin');
|
||||
$this->include_stylesheet('skins/' . $skin . '/calendar.css');
|
||||
}
|
||||
|
||||
if ($this->rc->task == 'calendar' && $this->rc->action != 'save-pref') {
|
||||
|
@ -1193,32 +1191,39 @@ class calendar extends rcube_plugin
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle for printing calendars
|
||||
* Handler for printing calendars
|
||||
*/
|
||||
|
||||
public function print_view()
|
||||
{
|
||||
|
||||
|
||||
$this->rc->output->set_pagetitle($this->gettext('Print'));
|
||||
$this->rc->output->set_env('nview', get_input_value('nview', RCUBE_INPUT_GPC));
|
||||
$title = $this->gettext('print');
|
||||
|
||||
$view = get_input_value('view', RCUBE_INPUT_GPC);
|
||||
if (!in_array($view, array('agendaWeek', 'agendaDay', 'month', 'table')))
|
||||
$view = 'agendaDay';
|
||||
|
||||
$this->rc->output->set_env('view',$view);
|
||||
|
||||
if ($date = get_input_value('date', RCUBE_INPUT_GPC))
|
||||
$this->rc->output->set_env('date', $date);
|
||||
|
||||
if ($search = get_input_value('search', RCUBE_INPUT_GPC)) {
|
||||
$this->rc->output->set_env('search', $search);
|
||||
$title .= ' "' . $search . '"';
|
||||
}
|
||||
|
||||
// Add CSS stylesheets to the page header
|
||||
$skin = $this->rc->config->get('skin');
|
||||
$this->include_stylesheet('skins/' . $skin . '/fullcalendar.css');
|
||||
$this->include_stylesheet('skins/' . $skin . '/fullcalendar.printl.css');
|
||||
|
||||
$this->include_stylesheet('skins/' . $skin . '/print.css');
|
||||
|
||||
// Add JS files to the page header
|
||||
$this->include_script('print.js');
|
||||
|
||||
|
||||
$this->register_handler('plugin.calendar_css', array($this->ui, 'calendar_css'));
|
||||
$this->register_handler('plugin.calendar_list', array($this->ui, 'calendar_list'));
|
||||
$this->register_handler('plugin.calendar_select', array($this->ui, 'calendar_select'));
|
||||
|
||||
|
||||
// $this->rc->output->add_label('low','normal','high','delete','cancel','uploading','noemailwarning');
|
||||
|
||||
$this->rc->output->set_pagetitle($title);
|
||||
$this->rc->output->send("calendar.print");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ function rcube_calendar_ui(settings)
|
|||
// convert the given Date object into a unix timestamp respecting browser's and user's timezone settings
|
||||
var date2unixtime = function(date)
|
||||
{
|
||||
return date.getTime()/1000 + gmt_offset * 3600;
|
||||
return Math.round(date.getTime()/1000 + gmt_offset * 3600);
|
||||
};
|
||||
|
||||
var fromunixtime = function(ts)
|
||||
|
@ -830,11 +830,14 @@ function rcube_calendar_ui(settings)
|
|||
|
||||
|
||||
/*** public methods ***/
|
||||
//public method to show the print dialog.
|
||||
this.print_calendars = function(view) {
|
||||
|
||||
window.open ("?_task=calendar&_action=print&nview="+view.name+"","rc_print_calendars","width=670");
|
||||
|
||||
|
||||
//public method to show the print dialog.
|
||||
this.print_calendars = function(view)
|
||||
{
|
||||
if (!view) view = fc.fullCalendar('getView').name;
|
||||
var date = fc.fullCalendar('getDate') || new Date();
|
||||
var printwin = window.open(rcmail.url('print', { view: view, date: date2unixtime(date), search: this.search_query }), "rc_print_calendars", "toolbar=no,location=yes,menubar=yes,resizable=yes,scrollbars=yes,width=800");
|
||||
window.setTimeout(function(){ printwin.focus() }, 50);
|
||||
};
|
||||
|
||||
|
||||
|
@ -994,6 +997,7 @@ function rcube_calendar_ui(settings)
|
|||
|
||||
// replace event source from fullcalendar
|
||||
this.search_request = id;
|
||||
this.search_query = q;
|
||||
this.search_source = {
|
||||
url: "./?_task=calendar&_action=search_events&q="+escape(q)+'&source='+escape(sources.join(',')),
|
||||
editable: false
|
||||
|
@ -1027,7 +1031,7 @@ function rcube_calendar_ui(settings)
|
|||
if (this.default_view)
|
||||
fc.fullCalendar('changeView', this.default_view);
|
||||
|
||||
this.search_request = this.search_source = null;
|
||||
this.search_request = this.search_source = this.search_query = null;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1436,7 +1440,7 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
|
|||
|
||||
// configure toolbar buttons
|
||||
rcmail.register_command('addevent', function(){ cal.add_event(); }, true);
|
||||
rcmail.register_command('print', function(){ cal.print_calendars($('#calendar').fullCalendar('getView')); }, true);
|
||||
rcmail.register_command('print', function(){ cal.print_calendars(); }, true);
|
||||
|
||||
// configure list operations
|
||||
rcmail.register_command('calendar-create', function(){ cal.calendar_edit_dialog(null); }, true);
|
||||
|
|
|
@ -49,6 +49,12 @@ class calendar_ui
|
|||
// load basic client script (which - unfortunately - requires fullcalendar)
|
||||
$this->calendar->include_script('lib/js/fullcalendar.js');
|
||||
$this->calendar->include_script('calendar_base.js');
|
||||
|
||||
$skin = $this->rc->config->get('skin');
|
||||
$this->calendar->include_stylesheet('skins/' . $skin . '/calendar.css');
|
||||
|
||||
// add iehacks to page footer
|
||||
$this->rc->output->add_footer('<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="'.$this->calendar->urlbase.'skins/'.$skin.'/iehacks.css" /><![endif]-->');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +64,7 @@ class calendar_ui
|
|||
{
|
||||
$skin = $this->rc->config->get('skin');
|
||||
$this->calendar->include_stylesheet('skins/' . $skin . '/fullcalendar.css');
|
||||
$this->calendar->include_stylesheet('skins/' . $skin . '/jquery.miniColors.css');
|
||||
$this->calendar->include_stylesheet('skins/' . $skin . '/jquery.miniColors.css');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,27 +75,11 @@ class calendar_ui
|
|||
$this->calendar->include_script('calendar_ui.js');
|
||||
$this->calendar->include_script('lib/js/jquery.miniColors.min.js');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Calendar toolbar
|
||||
*/
|
||||
public function toolbar()
|
||||
{
|
||||
$skin = $this->rc->config->get('skin');
|
||||
$this->calendar->add_button(array(
|
||||
'command' => 'export_events',
|
||||
'href' => './?_task=calendar&_action=export_events',
|
||||
'title' => 'calendar.export',
|
||||
'imagepas' => 'skins/' . $skin . '/images/export.png',
|
||||
'imageact' => 'skins/' . $skin . '/images/export.png'),
|
||||
'toolbar'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function calendar_css()
|
||||
function calendar_css($attrib = array())
|
||||
{
|
||||
$categories = $this->rc->config->get('calendar_categories', array());
|
||||
|
||||
|
@ -117,7 +107,8 @@ class calendar_ui
|
|||
$css .= ".fc-event-" . $class . ", ";
|
||||
$css .= ".fc-event-" . $class . " .fc-event-inner, ";
|
||||
$css .= ".fc-event-" . $class . " .fc-event-time {\n";
|
||||
$css .= "background-color: #" . $color . ";\n";
|
||||
if (!$attrib['printmode'])
|
||||
$css .= "background-color: #" . $color . ";\n";
|
||||
$css .= "border-color: #" . $color . ";\n";
|
||||
$css .= "}\n";
|
||||
}
|
||||
|
@ -135,6 +126,9 @@ class calendar_ui
|
|||
|
||||
$li = '';
|
||||
foreach ((array)$calendars as $id => $prop) {
|
||||
if ($attrib['activeonly'] && in_array($id, $hidden))
|
||||
continue;
|
||||
|
||||
unset($prop['user_id']);
|
||||
$prop['alarms'] = $this->calendar->driver->alarms;
|
||||
$prop['attendees'] = $this->calendar->driver->attendees;
|
||||
|
@ -156,8 +150,7 @@ class calendar_ui
|
|||
$this->rc->output->set_env('calendars', $jsenv);
|
||||
$this->rc->output->add_gui_object('folderlist', $attrib['id']);
|
||||
|
||||
unset($attrib['name']);
|
||||
return html::tag('ul', $attrib, $li);
|
||||
return html::tag('ul', $attrib, $li, html::$common_attrib);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -5664,7 +5664,7 @@ function TableEventRenderer() {
|
|||
s += "<td class='fc-event-time'>" + htmlEscape(times[1]) + "</td>";
|
||||
}
|
||||
} else {
|
||||
s += "<td class='fc-event-" + col + "'>" + htmlEscape(event[col] || '') + "</td>";
|
||||
s += "<td class='fc-event-" + col + "'>" + (htmlEscape(event[col]) || ' ') + "</td>";
|
||||
}
|
||||
}
|
||||
s += "</tr>";
|
||||
|
|
|
@ -31,6 +31,7 @@ $labels['edit'] = 'Edit';
|
|||
$labels['save'] = 'Save';
|
||||
$labels['remove'] = 'Remove';
|
||||
$labels['cancel'] = 'Cancel';
|
||||
$labels['print'] = 'Print calendars';
|
||||
$labels['title'] = 'Summary';
|
||||
$labels['description'] = 'Description';
|
||||
$labels['all-day'] = 'all-day';
|
||||
|
@ -53,12 +54,7 @@ $labels['confidential'] = 'confidential';
|
|||
$labels['alarms'] = 'Reminder';
|
||||
$labels['generated'] = 'generated at';
|
||||
$labels['selectdate'] = 'Select date';
|
||||
$labels['prev_year'] = 'Previous year';
|
||||
$labels['prev_month'] = 'Previous month';
|
||||
$labels['next_year'] = 'Next year';
|
||||
$labels['next_month'] = 'Next month';
|
||||
$labels['choose_date'] = 'Choose date';
|
||||
|
||||
$labels['printdescriptions'] = 'Print descriptions';
|
||||
|
||||
// alarm/reminder settings
|
||||
$labels['alarmemail'] = 'Send E-mail';
|
||||
|
|
|
@ -7,205 +7,147 @@
|
|||
| it under the terms of the GNU General Public License version 2 |
|
||||
| as published by the Free Software Foundation. |
|
||||
| |
|
||||
| This program is distributed in the hope that it will be useful, |
|
||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||
| GNU General Public License for more details. |
|
||||
| |
|
||||
| You should have received a copy of the GNU General Public License along |
|
||||
| with this program; if not, write to the Free Software Foundation, Inc., |
|
||||
| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
||||
| |
|
||||
+-------------------------------------------------------------------------+
|
||||
| Author: Lazlo Westerhof <hello@lazlo.me> |
|
||||
| Thomas Bruederli <roundcube@gmail.com> |
|
||||
+-------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
// Roundcube calendar UI client class
|
||||
function rcube_calendar_print(settings)
|
||||
{
|
||||
// extend base class
|
||||
rcube_calendar.call(this, settings);
|
||||
|
||||
/*** private vars ***/
|
||||
var me = this;
|
||||
var gmt_offset = (new Date().getTimezoneOffset() / -60) - (settings.timezone || 0);
|
||||
|
||||
|
||||
/*** startup code ***/
|
||||
|
||||
// create list of event sources AKA calendars
|
||||
this.calendars = {};
|
||||
var li, cal, active, event_sources = [];
|
||||
for (var id in rcmail.env.calendars) {
|
||||
cal = rcmail.env.calendars[id];
|
||||
this.calendars[id] = $.extend({
|
||||
url: "./?_task=calendar&_action=load_events&source="+escape(id),
|
||||
editable: !cal.readonly,
|
||||
className: 'fc-event-cal-'+id,
|
||||
id: id
|
||||
}, cal);
|
||||
|
||||
if ((active = ($.inArray(String(id), settings.hidden_calendars) < 0))) {
|
||||
this.calendars[id].active = true;
|
||||
event_sources.push(this.calendars[id]);
|
||||
}
|
||||
|
||||
// init event handler on calendar list checkbox
|
||||
if ((li = rcmail.get_folder_li(id, 'rcmlical'))) {
|
||||
$('#'+li.id+' input').click(function(e){
|
||||
var id = $(this).data('id');
|
||||
if (me.calendars[id]) { // add or remove event source on click
|
||||
var action;
|
||||
if (this.checked) {
|
||||
action = 'addEventSource';
|
||||
me.calendars[id].active = true;
|
||||
settings.hidden_calendars = $.map(settings.hidden_calendars, function(v){ return v == id ? null : v; });
|
||||
}
|
||||
else {
|
||||
action = 'removeEventSource';
|
||||
me.calendars[id].active = false;
|
||||
settings.hidden_calendars.push(id);
|
||||
}
|
||||
// just trigger search again (don't save prefs?)
|
||||
if (me.search_request) {
|
||||
me.quicksearch();
|
||||
}
|
||||
else { // add/remove event source
|
||||
fc.fullCalendar(action, me.calendars[id]);
|
||||
rcmail.save_pref({ name:'hidden_calendars', value:settings.hidden_calendars.join(',') });
|
||||
}
|
||||
}
|
||||
}).data('id', id).get(0).checked = active;
|
||||
|
||||
$(li).click(function(e){
|
||||
var id = $(this).data('id');
|
||||
rcmail.select_folder(id, me.selected_calendar, 'rcmlical');
|
||||
rcmail.enable_command('calendar-edit','calendar-remove', !me.calendars[id].readonly);
|
||||
me.selected_calendar = id;
|
||||
}).data('id', id);
|
||||
}
|
||||
|
||||
if (!cal.readonly && !this.selected_calendar && (!settings.default_calendar || settings.default_calendar == id)) {
|
||||
this.selected_calendar = id;
|
||||
rcmail.enable_command('addevent', true);
|
||||
}
|
||||
}
|
||||
|
||||
// initalize the fullCalendar plugin
|
||||
var fc = $('#calendar').fullCalendar({
|
||||
header: {
|
||||
left: '',
|
||||
center: 'title',
|
||||
right: ''
|
||||
},
|
||||
aspectRatio: 1,
|
||||
ignoreTimezone: true, // will treat the given date strings as in local (browser's) timezone
|
||||
height: '100%',
|
||||
eventSources: event_sources,
|
||||
monthNames : settings['months'],
|
||||
monthNamesShort : settings['months_short'],
|
||||
dayNames : settings['days'],
|
||||
dayNamesShort : settings['days_short'],
|
||||
firstDay : settings['first_day'],
|
||||
firstHour : settings['first_hour'],
|
||||
slotMinutes : 60/settings['timeslots'],
|
||||
timeFormat: {
|
||||
'': settings['time_format'],
|
||||
agenda: settings['time_format'] + '{ - ' + settings['time_format'] + '}',
|
||||
list: settings['time_format'] + '{ - ' + settings['time_format'] + '}',
|
||||
table: settings['time_format'] + '{ - ' + settings['time_format'] + '}'
|
||||
},
|
||||
axisFormat : settings['time_format'],
|
||||
columnFormat: {
|
||||
month: 'ddd', // Mon
|
||||
week: 'ddd ' + settings['date_short'], // Mon 9/7
|
||||
day: 'dddd ' + settings['date_short'], // Monday 9/7
|
||||
list: settings['date_agenda'],
|
||||
table: settings['date_agenda']
|
||||
},
|
||||
titleFormat: {
|
||||
month: 'MMMM yyyy',
|
||||
week: settings['date_long'].replace(/ yyyy/, '[ yyyy]') + "{ '—' " + settings['date_long'] + "}",
|
||||
day: 'dddd ' + settings['date_long'],
|
||||
list: settings['date_long'],
|
||||
table: settings['date_long']
|
||||
},
|
||||
listSections: 'smart',
|
||||
listRange: 60, // show 60 days in list view
|
||||
tableCols: ['handle', 'date', 'time', 'title', 'location'],
|
||||
defaultView: rcmail.env.nview,
|
||||
allDayText: rcmail.gettext('all-day', 'calendar'),
|
||||
selectable: false,
|
||||
selectHelper: true,
|
||||
loading: function(isLoading) {
|
||||
this._rc_loading = rcmail.set_busy(isLoading, 'loading', this._rc_loading);
|
||||
// trigger callback
|
||||
if (!isLoading && me.search_request)
|
||||
me.events_loaded($(this).fullCalendar('clientEvents').length);
|
||||
},
|
||||
// event rendering
|
||||
eventRender: function(event, element, view) {
|
||||
if (view.name != 'list' && view.name != 'table')
|
||||
element.attr('title', event.title);
|
||||
if (view.name == 'month') {
|
||||
/* attempt to limit the number of events displayed
|
||||
(could also be used to init fish-eye-view)
|
||||
var max = 4; // to be derrived from window size
|
||||
var sday = event.start.getMonth()*12 + event.start.getDate();
|
||||
var eday = event.end.getMonth()*12 + event.end.getDate();
|
||||
if (!me.eventcount[sday]) me.eventcount[sday] = 1;
|
||||
else me.eventcount[sday]++;
|
||||
if (!me.eventcount[eday]) me.eventcount[eday] = 1;
|
||||
else if (eday != sday) me.eventcount[eday]++;
|
||||
|
||||
if (me.eventcount[sday] > max || me.eventcount[eday] > max)
|
||||
return false;
|
||||
*/
|
||||
}
|
||||
else {
|
||||
if (event.location) {
|
||||
element.find('div.fc-event-title').after('<div class="fc-event-location">@ ' + Q(event.location) + '</div>');
|
||||
}
|
||||
if (event.recurrence)
|
||||
element.find('div.fc-event-time').append('<i class="fc-icon-recurring"></i>');
|
||||
if (event.alarms)
|
||||
element.find('div.fc-event-time').append('<i class="fc-icon-alarms"></i>');
|
||||
}
|
||||
},
|
||||
|
||||
viewDisplay: function(view) {
|
||||
me.eventcount = [];
|
||||
if (!bw.ie)
|
||||
window.setTimeout(function(){ $('div.fc-content').css('overflow', view.name == 'month' ? 'auto' : 'hidden') }, 10);
|
||||
},
|
||||
windowResize: function(view) {
|
||||
me.eventcount = [];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// add proprietary css styles if not IE
|
||||
if (!bw.ie)
|
||||
$('div.fc-content').addClass('rcube-fc-content');
|
||||
|
||||
|
||||
} // end rcube_calendar class
|
||||
|
||||
|
||||
/* calendar plugin initialization */
|
||||
/* calendar plugin printing code */
|
||||
window.rcmail && rcmail.addEventListener('init', function(evt) {
|
||||
|
||||
// quote html entities
|
||||
var Q = function(str)
|
||||
{
|
||||
return String(str).replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||
};
|
||||
|
||||
// let's go
|
||||
var cal = new rcube_calendar_print(rcmail.env.calendar_settings);
|
||||
var rc_loading;
|
||||
var showdesc = true;
|
||||
var settings = rcmail.env.calendar_settings;
|
||||
|
||||
// create list of event sources AKA calendars
|
||||
var src, calendars = [], event_sources = [];
|
||||
for (var id in rcmail.env.calendars) {
|
||||
source = $.extend({
|
||||
url: "./?_task=calendar&_action=load_events&source="+escape(id),
|
||||
className: 'fc-event-cal-'+id,
|
||||
id: id
|
||||
}, rcmail.env.calendars[id]);
|
||||
|
||||
$(window).resize(function() {
|
||||
$('#calendar').fullCalendar('option', 'height', $('#main').height());
|
||||
}).resize();
|
||||
event_sources.push(source);
|
||||
calendars.push(id);
|
||||
}
|
||||
|
||||
// search query is active
|
||||
if (rcmail.env.search) {
|
||||
event_sources = [{ url: "./?_task=calendar&_action=search_events&q="+escape(rcmail.env.search)+'&source='+escape(calendars.join(',')) }];
|
||||
}
|
||||
|
||||
var viewdate = new Date();
|
||||
if (rcmail.env.date)
|
||||
viewdate.setTime(rcmail.env.date * 1000);
|
||||
|
||||
// initalize the fullCalendar plugin
|
||||
var fc = $('#calendar').fullCalendar({
|
||||
header: {
|
||||
left: '',
|
||||
center: 'title',
|
||||
right: 'agendaDay,agendaWeek,month,table'
|
||||
},
|
||||
aspectRatio: 0.85,
|
||||
ignoreTimezone: true, // will treat the given date strings as in local (browser's) timezone
|
||||
date: viewdate.getDate(),
|
||||
month: viewdate.getMonth(),
|
||||
year: viewdate.getFullYear(),
|
||||
defaultView: rcmail.env.view,
|
||||
eventSources: event_sources,
|
||||
monthNames : settings['months'],
|
||||
monthNamesShort : settings['months_short'],
|
||||
dayNames : settings['days'],
|
||||
dayNamesShort : settings['days_short'],
|
||||
firstDay : settings['first_day'],
|
||||
firstHour : settings['first_hour'],
|
||||
slotMinutes : 60/settings['timeslots'],
|
||||
timeFormat: {
|
||||
'': settings['time_format'],
|
||||
agenda: settings['time_format'] + '{ - ' + settings['time_format'] + '}',
|
||||
list: settings['time_format'] + '{ - ' + settings['time_format'] + '}',
|
||||
table: settings['time_format'] + '{ - ' + settings['time_format'] + '}'
|
||||
},
|
||||
axisFormat : settings['time_format'],
|
||||
columnFormat: {
|
||||
month: 'ddd', // Mon
|
||||
week: 'ddd ' + settings['date_short'], // Mon 9/7
|
||||
day: 'dddd ' + settings['date_short'], // Monday 9/7
|
||||
list: settings['date_agenda'],
|
||||
table: settings['date_agenda']
|
||||
},
|
||||
titleFormat: {
|
||||
month: 'MMMM yyyy',
|
||||
week: settings['date_long'].replace(/ yyyy/, '[ yyyy]') + "{ '—' " + settings['date_long'] + "}",
|
||||
day: 'dddd ' + settings['date_long'],
|
||||
list: settings['date_long'],
|
||||
table: settings['date_long']
|
||||
},
|
||||
listSections: 'smart',
|
||||
listRange: 60, // show 60 days in list view
|
||||
tableCols: ['handle', 'date', 'time', 'title', 'location'],
|
||||
allDayText: rcmail.gettext('all-day', 'calendar'),
|
||||
buttonText: {
|
||||
day: rcmail.gettext('day', 'calendar'),
|
||||
week: rcmail.gettext('week', 'calendar'),
|
||||
month: rcmail.gettext('month', 'calendar'),
|
||||
table: rcmail.gettext('agenda', 'calendar')
|
||||
},
|
||||
loading: function(isLoading) {
|
||||
rc_loading = rcmail.set_busy(isLoading, 'loading', rc_loading);
|
||||
},
|
||||
// event rendering
|
||||
eventRender: function(event, element, view) {
|
||||
if (view.name != 'month') {
|
||||
var cont = element.find('div.fc-event-title');
|
||||
if (event.location) {
|
||||
cont.after('<div class="fc-event-location">@ ' + Q(event.location) + '</div>');
|
||||
cont = cont.next();
|
||||
}
|
||||
if (event.description && showdesc) {
|
||||
cont.after('<div class="fc-event-description">' + Q(event.description) + '</div>');
|
||||
}
|
||||
/* TODO: create icons black on white
|
||||
if (event.recurrence)
|
||||
element.find('div.fc-event-time').append('<i class="fc-icon-recurring"></i>');
|
||||
if (event.alarms)
|
||||
element.find('div.fc-event-time').append('<i class="fc-icon-alarms"></i>');
|
||||
*/
|
||||
}
|
||||
if (view.name == 'table' && event.description && showdesc) {
|
||||
var cols = element.children().css('border', 0).length;
|
||||
element.after('<tr class="fc-event-row-secondary fc-event"><td colspan="'+cols+'" class="fc-event-description">' + Q(event.description) + '</td></tr>');
|
||||
}
|
||||
},
|
||||
viewDisplay: function(view) {
|
||||
// remove hard-coded hight and make contents visible
|
||||
window.setTimeout(function(){
|
||||
if (view.name == 'table') {
|
||||
$('div.fc-list-content').css('overflow', 'visible').height('auto');
|
||||
}
|
||||
else {
|
||||
$('div.fc-agenda-divider')
|
||||
.next().css('overflow', 'visible').height('auto')
|
||||
.children('div').css('overflow', 'visible').height('auto');
|
||||
}
|
||||
// adjust fixed height if vertical day slots
|
||||
var h = $('table.fc-agenda-slots:visible').height() + $('table.fc-agenda-allday:visible').height() + 4;
|
||||
if (h) $('table.fc-agenda-days td.fc-widget-content').children('div').height(h);
|
||||
}, 20);
|
||||
}
|
||||
});
|
||||
|
||||
// activate settings form
|
||||
$('#propdescription').change(function(){
|
||||
showdesc = this.checked;
|
||||
fc.fullCalendar('render');
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* FullCalendar v1.5.1 Print Stylesheet
|
||||
*
|
||||
* Include this stylesheet on your page to get a more printer-friendly calendar.
|
||||
* When including this stylesheet, use the media='print' attribute of the <link> tag.
|
||||
* Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
|
||||
*
|
||||
* Copyright (c) 2011 Adam Shaw
|
||||
* Dual licensed under the MIT and GPL licenses, located in
|
||||
* MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
|
||||
*
|
||||
* Date: Sat Apr 9 14:09:51 2011 -0700
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* Events
|
||||
-----------------------------------------------------*/
|
||||
|
||||
.fc-event-skin {
|
||||
background: none !important;
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
/* horizontal events */
|
||||
|
||||
.fc-event-hori {
|
||||
border-width: 0 0 1px 0 !important;
|
||||
border-bottom-style: dotted !important;
|
||||
border-bottom-color: #000 !important;
|
||||
padding: 1px 0 0 0 !important;
|
||||
}
|
||||
|
||||
.fc-event-hori .fc-event-inner {
|
||||
border-width: 0 !important;
|
||||
padding: 0 1px !important;
|
||||
}
|
||||
|
||||
/* vertical events */
|
||||
|
||||
.fc-event-vert {
|
||||
border-width: 0 0 0 1px !important;
|
||||
border-left-style: dotted !important;
|
||||
border-left-color: #000 !important;
|
||||
padding: 0 1px 0 0 !important;
|
||||
}
|
||||
|
||||
.fc-event-vert .fc-event-inner {
|
||||
border-width: 0 !important;
|
||||
padding: 1px 0 !important;
|
||||
}
|
||||
|
||||
.fc-event-bg {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.fc-event .ui-resizable-handle {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* FullCalendar v1.5.1 Print Stylesheet
|
||||
*
|
||||
* Include this stylesheet on your page to get a more printer-friendly calendar.
|
||||
* When including this stylesheet, use the media='print' attribute of the <link> tag.
|
||||
* Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
|
||||
*
|
||||
* Copyright (c) 2011 Adam Shaw
|
||||
* Dual licensed under the MIT and GPL licenses, located in
|
||||
* MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
|
||||
*
|
||||
* Date: Sat Apr 9 14:09:51 2011 -0700
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/* Events
|
||||
-----------------------------------------------------*/
|
||||
|
||||
/**
|
||||
.fc-event-skin {
|
||||
background: none !important;
|
||||
color: #000 !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.fc-event-hori {
|
||||
border-width: 0 0 1px 0 !important;
|
||||
border-bottom-style: dotted !important;
|
||||
border-bottom-color: #000 !important;
|
||||
padding: 1px 0 0 0 !important;
|
||||
}
|
||||
|
||||
.fc-event-hori .fc-event-inner {
|
||||
border-width: 0 !important;
|
||||
padding: 0 1px !important;
|
||||
}
|
||||
|
||||
|
||||
.fc-event-vert {
|
||||
border-width: 0 0 0 1px !important;
|
||||
border-left-style: dotted !important;
|
||||
border-left-color: #000 !important;
|
||||
padding: 0 1px 0 0 !important;
|
||||
}
|
||||
|
||||
.fc-event-vert .fc-event-inner {
|
||||
border-width: 0 !important;
|
||||
padding: 1px 0 !important;
|
||||
}
|
||||
|
||||
.fc-event-bg {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.fc-event .ui-resizable-handle {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* UI
|
||||
*/
|
||||
|
||||
#calendar {
|
||||
position: absolute;
|
||||
overflow: visible;
|
||||
top: 0;
|
||||
left: 2px;
|
||||
right: 2px;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
#calendars {
|
||||
position: absolute;
|
||||
display:none;
|
||||
top: 25px;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
background-color: #F9F9F9;
|
||||
border: 1px solid #999999;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#main {
|
||||
position: absolute;
|
||||
clear: both;
|
||||
top: 25px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 10px;
|
||||
}
|
203
plugins/calendar/skins/default/print.css
Normal file
203
plugins/calendar/skins/default/print.css
Normal file
|
@ -0,0 +1,203 @@
|
|||
/*** Printing styles for Calendar plugin ***/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
body, td, th, div, p, h3, select, input, textarea {
|
||||
font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
#calendar {
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: auto;
|
||||
margin: 5em auto 0 auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
#printconfig {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 10000;
|
||||
padding: 0.5em;
|
||||
background: #ebebeb;
|
||||
border-bottom: 1px solid #999;
|
||||
box-shadow: 0 3px 4px #ccc;
|
||||
-moz-box-shadow: 0 3px 4px #ccc;
|
||||
-webkit-box-shadow: 0 3px 4px #ccc;
|
||||
}
|
||||
|
||||
#printconfig .prop {
|
||||
padding-right: 2em;
|
||||
}
|
||||
|
||||
#message {
|
||||
position: absolute;
|
||||
top: 5.5em;
|
||||
left: 1em;
|
||||
}
|
||||
|
||||
#message div.loading {
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#calendarlist {
|
||||
list-style-type: square;
|
||||
margin: 2em 0;
|
||||
padding-left: 1em;
|
||||
}
|
||||
|
||||
#calendarlist li {
|
||||
float: left;
|
||||
padding-left: 0;
|
||||
padding-right: 3em;
|
||||
margin-left: 0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#calendarlist input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.calwidth {
|
||||
width: 700px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.rightalign {
|
||||
float: right;
|
||||
padding-top: 0.3em;
|
||||
}
|
||||
|
||||
@media print {
|
||||
.noprint,
|
||||
.fc-header-right span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#calendar {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* fullcalendar style overrides */
|
||||
|
||||
.fc-view {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.fc-event-skin,
|
||||
.fc-event-inner .fc-event-skin {
|
||||
color: black;
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.fc-event-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fc-event-hori .fc-event-title {
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fc-event-hori .fc-event-time {
|
||||
white-space: nowrap;
|
||||
font-weight: normal !important;
|
||||
font-size: 10px;
|
||||
padding-right: 0.6em;
|
||||
}
|
||||
|
||||
.fc-grid .fc-event-time {
|
||||
font-weight: normal !important;
|
||||
padding-right: 0.3em;
|
||||
}
|
||||
|
||||
.fc-event-cateories {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
div.fc-event-location {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.fc-agenda-slots td div {
|
||||
height: 1.4em;
|
||||
}
|
||||
|
||||
.fc-widget-header,
|
||||
.fc-mon, .fc-tue, .fc-wed, .fc-thu, .fc-fri {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.fc-widget-header, .fc-widget-content {
|
||||
border-color: #ccc;
|
||||
}
|
||||
|
||||
.fc-icon-alarms,
|
||||
.fc-icon-recurring {
|
||||
display: inline-block;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
background: url('images/eventicons.gif') 0 0 no-repeat;
|
||||
margin-left: 3px;
|
||||
line-height: 10px;
|
||||
}
|
||||
|
||||
.fc-icon-alarms {
|
||||
background-position: 0 -13px;
|
||||
}
|
||||
|
||||
.fc-view-list, .fc-view-table {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.fc-view-list div.fc-list-header,
|
||||
.fc-view-table td.fc-list-header {
|
||||
padding: 0.3em;
|
||||
background: #fff;
|
||||
font-weight: bold;
|
||||
font-size: 1.2em;
|
||||
color: #333;
|
||||
border-color: #333;
|
||||
border-style: solid;
|
||||
border-width: 1px 0;
|
||||
filter: none;
|
||||
}
|
||||
|
||||
.fc-list-section .fc-event {
|
||||
cursor: auto;
|
||||
}
|
||||
|
||||
.fc-view-table tr.fc-event td,
|
||||
.fc-view-table tr.fc-event td.fc-event-handle {
|
||||
border-color: #999;
|
||||
padding-top: 0.5em;
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.fc-view-table tr.fc-last td {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.fc-view-table tr.fc-event .fc-event-description {
|
||||
padding-left: 2em;
|
||||
padding-top: 0em;
|
||||
}
|
||||
|
||||
.fc-event-vert .fc-event-description {
|
||||
font-size: 90%;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
.fc-view-table col.fc-event-location {
|
||||
width: 20%;
|
||||
}
|
25
plugins/calendar/skins/default/print.iehacks.css
Normal file
25
plugins/calendar/skins/default/print.iehacks.css
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* CSS hacks for IE 6/7 */
|
||||
|
||||
#calendar {
|
||||
top: 5em;
|
||||
}
|
||||
|
||||
.calwidth {
|
||||
width: 172mm;
|
||||
}
|
||||
|
||||
.fc-header-title h2 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
#calendarlist li {
|
||||
float: none;
|
||||
padding: 0;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
@media print {
|
||||
#calendar {
|
||||
top: 0;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@
|
|||
<head>
|
||||
<title><roundcube:object name="pagetitle" /></title>
|
||||
<roundcube:include file="/includes/links.html" />
|
||||
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="./plugins/calendar/skins/default/iehacks.css" /><![endif]-->
|
||||
<script type="text/javascript" src="/functions.js"></script>
|
||||
</head>
|
||||
<body class="calendarmain">
|
||||
|
|
|
@ -2,30 +2,27 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title><roundcube:object name="pagetitle" /></title>
|
||||
<roundcube:include file="/includes/links.html" />
|
||||
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="./plugins/calendar/skins/default/iehacks.css" /><![endif]-->
|
||||
<script type="text/javascript" src="/functions.js"></script>
|
||||
</head>
|
||||
<roundcube:object name="message" id="message" />
|
||||
<body class="calendarmain">
|
||||
<div id="noprint"><input type="button" id="printme" value="Print"></div>
|
||||
<div id="main">
|
||||
<div id="printablearea">
|
||||
<div id="calendars">
|
||||
<div class="boxlistcontent">
|
||||
<roundcube:object name="plugin.calendar_list" id="calendarslist" />
|
||||
</div>
|
||||
</div>
|
||||
<body class="calendarprint">
|
||||
|
||||
<div id="printconfig" class="noprint">
|
||||
<div class="calwidth">
|
||||
<a href="#close" onclick="window.close()" class="rightalign"><roundcube:label name="close" /></a>
|
||||
<span class="prop"><input type="button" id="printme" value="<roundcube:label name='print' />" onclick="window.print()"></span>
|
||||
<span class="prop"><label><input type="checkbox" id="propdescription" checked="checked" /> <roundcube:label name="calendar.printdescriptions" /></label></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="calendar"></div>
|
||||
<roundcube:object name="message" id="message" class="noprint" />
|
||||
|
||||
<roundcube:object name="plugin.calendar_css" />
|
||||
<div id="calendar" class="calwidth"></div>
|
||||
|
||||
<div class="calwidth">
|
||||
<roundcube:object name="plugin.calendar_list" activeonly="true" id="calendarlist" />
|
||||
</div>
|
||||
<script>
|
||||
$('#printme').click(function() {
|
||||
alert('Not working yet');
|
||||
});
|
||||
</script>
|
||||
|
||||
<roundcube:object name="plugin.calendar_css" printmode="true" />
|
||||
|
||||
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="./plugins/calendar/skins/default/print.iehacks.css" /><![endif]-->
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Reference in a new issue