Add Terminate button on document editing page (T845)
This commit is contained in:
parent
c323706a9b
commit
9d32f5cbae
4 changed files with 39 additions and 4 deletions
|
@ -1006,7 +1006,8 @@ function kolab_files_selected()
|
|||
|
||||
function kolab_files_frame_load(frame)
|
||||
{
|
||||
var win = frame.contentWindow;
|
||||
var win = frame.contentWindow,
|
||||
info = rcmail.env.file_data;
|
||||
|
||||
try {
|
||||
rcmail.file_editor = win.file_editor && win.file_editor.editable ? win.file_editor : null;
|
||||
|
@ -1018,10 +1019,9 @@ function kolab_files_frame_load(frame)
|
|||
rcmail.files_edit();
|
||||
|
||||
rcmail.enable_command('files-edit', rcmail.file_editor
|
||||
|| (rcmail.env.file_data.viewer && rcmail.env.file_data.viewer.manticore));
|
||||
|| (info && info.viewer && info.viewer.manticore));
|
||||
rcmail.enable_command('files-print', (rcmail.file_editor && rcmail.file_editor.printable)
|
||||
|| (rcmail.env.file_data && /^image\//i.test(rcmail.env.file_data.type)));
|
||||
|
||||
|| (info && /^image\//i.test(info.type)));
|
||||
// detect Print button and check if it can be accessed
|
||||
try {
|
||||
if ($('#fileframe').contents().find('#print').length)
|
||||
|
@ -1122,7 +1122,10 @@ function kolab_files_progress_str(param)
|
|||
// Initialize document toolbar functionality
|
||||
function manticore_init()
|
||||
{
|
||||
var info = rcmail.env.file_data;
|
||||
|
||||
rcmail.enable_command('document-save', 'document-export', true);
|
||||
rcmail.enable_command('files-close', info && info.session && info.session.is_owner);
|
||||
};
|
||||
|
||||
rcube_webmail.prototype.document_save = function()
|
||||
|
@ -1280,6 +1283,13 @@ rcube_webmail.prototype.files_edit = function(session)
|
|||
}
|
||||
};
|
||||
|
||||
// close editing session
|
||||
rcube_webmail.prototype.files_close = function()
|
||||
{
|
||||
// @todo: check document "unsaved changes" state and display a warning
|
||||
file_api.document_delete(this.env.file_data.session.id);
|
||||
};
|
||||
|
||||
rcube_webmail.prototype.files_save = function()
|
||||
{
|
||||
if (!this.file_editor)
|
||||
|
@ -2906,6 +2916,25 @@ function kolab_files_ui()
|
|||
}
|
||||
};
|
||||
|
||||
// document session delete request
|
||||
this.document_delete = function(id)
|
||||
{
|
||||
this.req = this.set_busy(true, 'kolab_files.sessionterminating');
|
||||
this.request('document_delete', {id: id}, 'document_delete_response');
|
||||
};
|
||||
|
||||
// document session delete response handler
|
||||
this.document_delete_response = function(response)
|
||||
{
|
||||
if (!this.response(response))
|
||||
return;
|
||||
|
||||
if (rcmail.task == 'files' && rcmail.env.action == 'edit')
|
||||
window.close();
|
||||
|
||||
// @todo: force sessions info update
|
||||
};
|
||||
|
||||
// handle auth errors on folder list
|
||||
this.folder_list_auth_errors = function(result)
|
||||
{
|
||||
|
|
|
@ -918,6 +918,8 @@ class kolab_files_engine
|
|||
*/
|
||||
protected function action_edit()
|
||||
{
|
||||
$this->plugin->add_label('sessionterminating');
|
||||
|
||||
$this->file_opener(intval($_GET['_viewer']));
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,9 @@ $labels['joinsession'] = 'Request an invitation from $user';
|
|||
$labels['editfilero'] = 'This file is read-only. Do you want to create and edit a copy of the file?';
|
||||
$labels['editfilerotitle'] = 'Read-only file';
|
||||
$labels['select'] = 'Select';
|
||||
$labels['terminatesession'] = 'Terminate the session';
|
||||
$labels['terminate'] = 'Terminate';
|
||||
$labels['sessionterminating'] = 'Terminating the session...';
|
||||
|
||||
$labels['storepasswords'] = 'remember password';
|
||||
$labels['storepasswordsdesc'] = 'Stored passwords will be encrypted. Enable this if you do not want to be asked for the password on every login or you want this storage to be available via WebDAV.';
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<!--
|
||||
<roundcube:button command="files-delete" type="link" class="button delete disabled" classAct="button delete" classSel="button delete pressed" label="delete" title="kolab_files.deletefile" />
|
||||
-->
|
||||
<roundcube:button command="files-close" type="link" class="button delete disabled" classAct="button delete" classSel="button delete pressed" label="kolab_files.terminate" title="kolab_files.terminatesession" />
|
||||
<span class="dropbutton">
|
||||
<roundcube:button command="document-export" type="link" class="button export disabled" classAct="button export" classSel="button export pressed" label="kolab_files.get" title="kolab_files.getfile" />
|
||||
<a href="#export" class="dropbuttontip" id="exportmenulink" onclick="UI.toggle_popup('exportmenu',event);return false" aria-haspopup="true" aria-expanded="false" aria-owns="exportmenu-menu" tabindex="0">Export options</a>
|
||||
|
|
Loading…
Add table
Reference in a new issue