diff --git a/plugins/calendar/calendar_ui.js b/plugins/calendar/calendar_ui.js index 59fa93a7..4c993307 100644 --- a/plugins/calendar/calendar_ui.js +++ b/plugins/calendar/calendar_ui.js @@ -1310,8 +1310,8 @@ function rcube_calendar_ui(settings) success: function(data) { $dialog.html(data); // resize and reposition dialog window - me.dialog_resize('#calendarform', $('#calendar-details').height(), $('#calendar-details').width()); form = $('form', $('#calendarform')); // '#calendarform > form' doesn't work here + me.dialog_resize('#calendarform', form.height(), form.width()); name = $('#calendar-name').prop('disabled', !calendar.editable).val(calendar.editname || calendar.name); color = $('#calendar-color').val(calendar.color).miniColors({ value: calendar.color }); name.select(); @@ -1362,7 +1362,7 @@ function rcube_calendar_ui(settings) }).show(); }; - + this.calendar_remove = function(calendar) { if (confirm(rcmail.gettext('deletecalendarconfirm', 'calendar'))) { @@ -1371,7 +1371,7 @@ function rcube_calendar_ui(settings) } return false; }; - + this.calendar_destroy_source = function(id) { if (this.calendars[id]) { @@ -1429,7 +1429,7 @@ function rcube_calendar_ui(settings) this.reset_quicksearch(); } }; - + // reset search and get back to normal event listing this.reset_quicksearch = function() { @@ -1454,7 +1454,7 @@ function rcube_calendar_ui(settings) this.search_request = this.search_query = null; } }; - + // callback if all sources have been fetched from server this.events_loaded = function(count) { @@ -1465,17 +1465,18 @@ function rcube_calendar_ui(settings) // resize and reposition (center) the dialog window this.dialog_resize = function(id, height, width) { - height = Math.min(400, height+90); - width = Math.min(500, width+50); - var win = $(window), w = win.width(), h = win.height(); + height = Math.min(h-20, height+125); + width = Math.min(w-20, width+50); + w = w - width < 0 ? 0 : (w - width) / 2; h = h - height < 0 ? 0 : (h - height) / 2; $(id).dialog('option', { height: height, width: width, position: [w, h] }); }; + /*** startup code ***/ // create list of event sources AKA calendars diff --git a/plugins/calendar/drivers/calendar_driver.php b/plugins/calendar/drivers/calendar_driver.php index 29c202ef..db5ee8aa 100644 --- a/plugins/calendar/drivers/calendar_driver.php +++ b/plugins/calendar/drivers/calendar_driver.php @@ -305,10 +305,11 @@ abstract class calendar_driver * * @param string Request action 'form-edit|form-new' * @param array Calendar properties (e.g. id, color) + * @param string HTML code of default edit form * * @return string HTML content of the form */ - public function calendar_form($action, $calendar) + public function calendar_form($action, $calendar, $html) { return null; } diff --git a/plugins/calendar/drivers/kolab/kolab_driver.php b/plugins/calendar/drivers/kolab/kolab_driver.php index 20329332..1c21f56b 100644 --- a/plugins/calendar/drivers/kolab/kolab_driver.php +++ b/plugins/calendar/drivers/kolab/kolab_driver.php @@ -827,10 +827,11 @@ class kolab_driver extends calendar_driver * * @param string Request action 'form-edit|form-new' * @param array Calendar properties (e.g. id, color) + * @param string HTML code of default edit form * * @return string HTML content of the form */ - public function calendar_form($action, $calendar) + public function calendar_form($action, $calendar, $html) { // Remove any scripts/css/js $this->rc->output->reset(); diff --git a/plugins/calendar/lib/calendar_ui.php b/plugins/calendar/lib/calendar_ui.php index 71aeb97d..4e7dcaf0 100644 --- a/plugins/calendar/lib/calendar_ui.php +++ b/plugins/calendar/lib/calendar_ui.php @@ -537,10 +537,21 @@ class calendar_ui */ function calendar_editform($action, $calendar = array()) { - $html = $this->calendar->driver->calendar_form($action, $calendar); + // compose default calendar form + $input_name = new html_inputfield(array('name' => 'name', 'id' => 'calendar-name', 'size' => 20)); + $html = html::div('form-section', + html::label('calendar-name', $this->calendar->gettext('name')) . + $input_name->show($calendar['name'])); - if (!$html) - $html = $this->rc->output->parse('calendar.calendarform', false, false); + $input_color = new html_inputfield(array('name' => 'color', 'id' => 'calendar-color', 'size' => 6)); + $html .= html::div('form-section', + html::label('calendar-color', $this->calendar->gettext('color')) . + $input_color->show($calendar['color'])); + + $html = html::tag('form', array('action' => "#", 'method' => "get", 'id' => 'calendarpropform'), $html); + + // allow driver to extend or replace the form content + $html = $this->calendar->driver->calendar_form($action, $calendar, $html); return $html; }