Elastic: Attachments tab in event edit dialog
This commit is contained in:
parent
ac454a59a7
commit
e3f7593162
5 changed files with 29 additions and 33 deletions
|
@ -663,7 +663,7 @@ function rcube_calendar_ui(settings)
|
|||
freebusy_ui.needsupdate = false;
|
||||
|
||||
// reset dialog first
|
||||
$('#eventtabs').get(0).reset();
|
||||
$('#eventedit form').trigger('reset');
|
||||
$('#event-panel-recurrence input, #event-panel-recurrence select, #event-panel-attachments input').prop('disabled', false);
|
||||
$('#event-panel-recurrence, #event-panel-attachments').removeClass('disabled');
|
||||
|
||||
|
@ -800,7 +800,7 @@ function rcube_calendar_ui(settings)
|
|||
// attachments
|
||||
var load_attachments_tab = function()
|
||||
{
|
||||
rcmail.enable_command('remove-attachment', calendar.editable && !event.recurrence_id);
|
||||
rcmail.enable_command('remove-attachment', 'upload-file', calendar.editable && !event.recurrence_id);
|
||||
rcmail.env.deleted_attachments = [];
|
||||
// we're sharing some code for uploads handling with app.js
|
||||
rcmail.env.attachments = [];
|
||||
|
@ -928,13 +928,18 @@ function rcube_calendar_ui(settings)
|
|||
}
|
||||
});
|
||||
|
||||
// show/hide tabs according to calendar's feature support
|
||||
// show/hide tabs according to calendar's feature support and activate first tab (Larry)
|
||||
$('#edit-tab-attendees')[(calendar.attendees?'show':'hide')]();
|
||||
$('#edit-tab-resources')[(rcmail.env.calendar_resources?'show':'hide')]();
|
||||
$('#edit-tab-attachments')[(calendar.attachments?'show':'hide')]();
|
||||
$('#eventedit:not([data-notabs]) > form').tabs('option', 'active', 0); // Larry
|
||||
|
||||
// activate the first tab
|
||||
$('#eventtabs').tabs('option', 'active', 0);
|
||||
// show/hide tabs according to calendar's feature support and activate first tab (Ellastic)
|
||||
$('li > a[href="#event-panel-attendees"]').parent()[(calendar.attendees?'show':'hide')]();
|
||||
$('li > a[href="#event-panel-resources"]').parent()[(rcmail.env.calendar_resources?'show':'hide')]();
|
||||
$('li > a[href="#event-panel-attachments"]').parent()[(calendar.attachments?'show':'hide')]();
|
||||
if ($('#eventedit').data('notabs'))
|
||||
$('#eventedit li.nav-item:first-child a').tab('show');
|
||||
|
||||
// hack: set task to 'calendar' to make all dialog actions work correctly
|
||||
var comm_path_before = rcmail.env.comm_path;
|
||||
|
@ -3940,12 +3945,10 @@ function rcube_calendar_ui(settings)
|
|||
}
|
||||
|
||||
// init event dialog
|
||||
$('#eventtabs').tabs({
|
||||
activate: function(event, ui) {
|
||||
// newPanel.selector for jQuery-UI 1.10, newPanel.attr('id') for jQuery-UI 1.12
|
||||
var tab = String(ui.newPanel.selector || ui.newPanel.attr('id'))
|
||||
.replace(/^#?event-panel-/, '').replace(/s$/, '');
|
||||
|
||||
var tab_change = function(event, ui) {
|
||||
// newPanel.selector for jQuery-UI 1.10, newPanel.attr('id') for jQuery-UI 1.12, href for Bootstrap tabs
|
||||
var tab = (ui ? String(ui.newPanel.selector || ui.newPanel.attr('id')) : $(event.target).attr('href'))
|
||||
.replace(/^#?event-panel-/, '').replace(/s$/, '');
|
||||
var has_real_attendee = function(attendees) {
|
||||
for (var i=0; i < (attendees ? attendees.length : 0); i++) {
|
||||
if (attendees[i].cutype != 'RESOURCE')
|
||||
|
@ -3974,8 +3977,11 @@ function rcube_calendar_ui(settings)
|
|||
$('#edit-recurrence-frequency').change();
|
||||
else
|
||||
$('#edit-recurrence-syncstart').hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$('#eventtabs').tabs({activate: tab_change}); // Larry
|
||||
$('#eventedit a.nav-link').on('show.bs.tab', tab_change); // Elastic
|
||||
|
||||
$('#edit-enddate').datepicker(datepicker_settings);
|
||||
$('#edit-startdate').datepicker(datepicker_settings).datepicker('option', 'onSelect', shift_enddate).change(function(){ shift_enddate(this.value); });
|
||||
$('#edit-enddate').datepicker('option', 'onSelect', event_times_changed).change(event_times_changed);
|
||||
|
|
|
@ -621,23 +621,11 @@ class calendar_ui
|
|||
function attachments_form($attrib = array())
|
||||
{
|
||||
// add ID if not given
|
||||
if (!$attrib['id'])
|
||||
if (!$attrib['id']) {
|
||||
$attrib['id'] = 'rcmUploadForm';
|
||||
}
|
||||
|
||||
// Get max filesize, enable upload progress bar
|
||||
$max_filesize = $this->rc->upload_init();
|
||||
|
||||
$button = new html_inputfield(array('type' => 'button'));
|
||||
$input = new html_inputfield(array(
|
||||
'type' => 'file', 'name' => '_attachments[]',
|
||||
'multiple' => 'multiple', 'size' => $attrib['attachmentfieldsize']));
|
||||
|
||||
return html::div($attrib,
|
||||
html::div(null, $input->show()) .
|
||||
html::div('buttons', $button->show($this->rc->gettext('upload'), array('class' => 'button mainaction',
|
||||
'onclick' => rcmail_output::JS_OBJECT_NAME . ".upload_file(this.form)"))) .
|
||||
html::div('hint', $this->rc->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize))))
|
||||
);
|
||||
return $this->rc->upload_form($attrib, 'uploadform', 'upload-file', array('multiple' => true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -608,7 +608,7 @@ a.miniColors-trigger {
|
|||
line-height: 20px;
|
||||
}
|
||||
|
||||
#edit-attachments ul li a.file {
|
||||
#edit-attachments ul li a.filename {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,9 +119,10 @@
|
|||
<div id="edit-attachments">
|
||||
<roundcube:object name="plugin.attachments_list" id="attachmentlist" class="attachmentslist" />
|
||||
</div>
|
||||
<div id="edit-attachments-form" role="region" aria-labelledby="aria-label-attachmentuploadform">
|
||||
<div id="edit-attachments-form" role="region" aria-labelledby="aria-label-attachmentuploadform" style="text-align:center">
|
||||
<h3 id="aria-label-attachmentuploadform" class="voice"><roundcube:label name="arialabelattachmentuploadform" /></h3>
|
||||
<roundcube:object name="plugin.attachments_form" id="calendar-attachment-form" attachmentFieldSize="30" />
|
||||
<roundcube:object name="plugin.attachments_form" id="calendar-attachment-form" mode="hint" />
|
||||
<a class="button" tabindex="1" href="#" onclick="rcmail.upload_input('edit-attachment-form')"><roundcube:label name="addattachment" /></a>
|
||||
</div>
|
||||
<roundcube:object name="plugin.filedroparea" id="event-panel-attachments" />
|
||||
</div>
|
||||
|
@ -130,5 +131,6 @@
|
|||
<roundcube:object name="plugin.edit_recurrence_sync" id="edit-recurrence-syncstart" class="event-dialog-message" style="display:none" />
|
||||
<roundcube:object name="plugin.edit_attendees_notify" id="edit-attendees-notify" class="event-dialog-message" style="display:none" />
|
||||
<roundcube:object name="plugin.edit_recurring_warning" class="event-dialog-message edit-recurring-warning" style="display:none" />
|
||||
<roundcube:object name="plugin.attachments_form" id="edit-attachment-form" mode="smart" />
|
||||
<div id="edit-localchanges-warning" class="event-dialog-message" style="display:none"><roundcube:label name="calendar.localchangeswarning" /></div>
|
||||
</div>
|
|
@ -64,12 +64,12 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function()
|
|||
else if (rcmail.task == 'calendar') {
|
||||
// add "attach from cloud" button for event dialog
|
||||
if (!rcmail.env.action)
|
||||
kolab_files_from_cloud_widget($('#calendar-attachment-form > div.buttons'));
|
||||
kolab_files_from_cloud_widget($('#calendar-attachment-form > div.buttons, #edit-attachments-form'));
|
||||
}
|
||||
else if (rcmail.task == 'tasks') {
|
||||
// add "attach from cloud" button for task dialog
|
||||
if (!rcmail.env.action)
|
||||
kolab_files_from_cloud_widget($('#taskedit-attachment-form > div.buttons'));
|
||||
kolab_files_from_cloud_widget($('#taskedit-attachment-form > div.buttons, #taskedit-attachments-form'));
|
||||
}
|
||||
else if (rcmail.task == 'files') {
|
||||
if (rcmail.gui_objects.fileslist) {
|
||||
|
|
Loading…
Add table
Reference in a new issue