Add sessionClosed event handling (T846)

This commit is contained in:
Aleksander Machniak 2015-12-07 16:08:28 +01:00
parent 9e5d6fe1c1
commit da5038ef62
3 changed files with 25 additions and 3 deletions

View file

@ -151,10 +151,11 @@ function kolab_files_init()
export_menu: rcmail.gui_objects.exportmenu ? $('ul', rcmail.gui_objects.exportmenu).get(0) : null,
title_input: $('#document-title').get(0),
members_list: $('#members').get(0),
photo_url: '?_task=addressbook&_action=photo&_email=%email',
photo_url: '?_task=addressbook&_action=photo&_error=1&_email=%email',
photo_default_url: rcmail.env.photo_placeholder,
// events
ready: function(data) { manticore_init(); }
ready: function(data) { manticore_init(); },
sessionClosed: function(data) { return manticore_close(); }
};
if (rcmail.env.file_data.writable)
@ -1165,6 +1166,25 @@ function manticore_init()
rcmail.enable_command('document-close', 'document-editors', true);
};
// executed on editing session termination
function manticore_close()
{
$('<div>').addClass('popupdialog').attr('role', 'alertdialog')
.html($('<span>').text(rcmail.gettext('kolab_files.sessionterminated')))
.dialog({
resizable: false,
closeOnEscape: true,
dialogClass: 'popupmessage error',
title: rcmail.gettext('kolab_files.sessionterminatedtitle'),
close: function() { window.close(); },
position: ['center', 'center'],
width: 420,
minHeight: 90
}).show();
return false; // skip Chwala's error message
};
rcube_webmail.prototype.document_save = function()
{
manticore.save(function(data) {

View file

@ -960,7 +960,7 @@ class kolab_files_engine
protected function action_edit()
{
$this->plugin->add_label('sessionterminating', 'unsavedchanges', 'documentinviting',
'documentcancelling', 'removeparticipant');
'documentcancelling', 'removeparticipant', 'sessionterminated', 'sessionterminatedtitle');
$this->file_opener(intval($_GET['_viewer']));
}

View file

@ -103,6 +103,8 @@ $labels['editfilero'] = 'This file is read-only. Do you want to create and edit
$labels['editfilerotitle'] = 'Read-only file';
$labels['select'] = 'Select';
$labels['terminatesession'] = 'Terminate the session';
$labels['sessionterminatedtitle'] = 'Session terminated';
$labels['sessionterminated'] = 'The session has been terminated. The window will be closed.';
$labels['terminate'] = 'Terminate';
$labels['sessionterminating'] = 'Terminating the session...';
$labels['unsavedchanges'] = 'There are unsaved changes in the document that will be lost. Do you want to terminate the session anyway?';