Manticore support - single-user mode
This commit is contained in:
parent
83951483f9
commit
9a0ba625aa
5 changed files with 122 additions and 23 deletions
|
@ -111,6 +111,16 @@ window.rcmail && window.files_api && rcmail.addEventListener('init', function()
|
||||||
|
|
||||||
if (rcmail.env.action == 'open') {
|
if (rcmail.env.action == 'open') {
|
||||||
rcmail.enable_command('files-get', 'files-delete', rcmail.env.file);
|
rcmail.enable_command('files-get', 'files-delete', rcmail.env.file);
|
||||||
|
|
||||||
|
if (rcmail.env.file_data.viewer && rcmail.env.file_data.viewer.manticore)
|
||||||
|
manticore = new manticore_api({
|
||||||
|
iframe: $('#fileframe').get(0),
|
||||||
|
ready: function(data) { manticore_init(); },
|
||||||
|
set_busy: function(state, message) { return rcmail.set_busy(state, message ? 'kolab_files.' + message : ''); },
|
||||||
|
hide_message: function(id) { return rcmail.hide_message(id); },
|
||||||
|
display_message: function(label, type) { return rcmail.display_message('kolab_files.' + label, type); },
|
||||||
|
gettext: function(label) { return rcmail.get_label('kolab_files.' + label); }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file_api.folder_list();
|
file_api.folder_list();
|
||||||
|
@ -539,7 +549,7 @@ function kolab_files_file_create_dialog()
|
||||||
};
|
};
|
||||||
|
|
||||||
// builds folder selector options
|
// builds folder selector options
|
||||||
kolab_files_folder_select_element = function(select, params)
|
function kolab_files_folder_select_element(select, params)
|
||||||
{
|
{
|
||||||
var options = [],
|
var options = [],
|
||||||
selected = params && params.selected ? params.selected : file_api.env.folder;
|
selected = params && params.selected ? params.selected : file_api.env.folder;
|
||||||
|
@ -677,7 +687,7 @@ function kolab_files_upload_input(button)
|
||||||
|
|
||||||
// for reordering column array (Konqueror workaround)
|
// for reordering column array (Konqueror workaround)
|
||||||
// and for setting some message list global variables
|
// and for setting some message list global variables
|
||||||
kolab_files_list_coltypes = function()
|
function kolab_files_list_coltypes()
|
||||||
{
|
{
|
||||||
var n, list = rcmail.file_list;
|
var n, list = rcmail.file_list;
|
||||||
|
|
||||||
|
@ -691,7 +701,7 @@ kolab_files_list_coltypes = function()
|
||||||
list.init_header();
|
list.init_header();
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_set_list_options = function(cols, sort_col, sort_order)
|
function kolab_files_set_list_options(cols, sort_col, sort_order)
|
||||||
{
|
{
|
||||||
var update = 0, i, idx, name, newcols = [], oldcols = rcmail.env.coltypes;
|
var update = 0, i, idx, name, newcols = [], oldcols = rcmail.env.coltypes;
|
||||||
|
|
||||||
|
@ -736,7 +746,7 @@ kolab_files_set_list_options = function(cols, sort_col, sort_order)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_set_coltypes = function(list)
|
function kolab_files_set_coltypes(list)
|
||||||
{
|
{
|
||||||
var i, found, name, cols = list.list.tHead.rows[0].cells;
|
var i, found, name, cols = list.list.tHead.rows[0].cells;
|
||||||
|
|
||||||
|
@ -755,12 +765,12 @@ kolab_files_set_coltypes = function(list)
|
||||||
rcmail.http_post('files/prefs', {kolab_files_list_cols: rcmail.env.coltypes});
|
rcmail.http_post('files/prefs', {kolab_files_list_cols: rcmail.env.coltypes});
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_list_dblclick = function(list)
|
function kolab_files_list_dblclick(list)
|
||||||
{
|
{
|
||||||
rcmail.command('files-open');
|
rcmail.command('files-open');
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_list_select = function(list)
|
function kolab_files_list_select(list)
|
||||||
{
|
{
|
||||||
var selected = list.selection.length;
|
var selected = list.selection.length;
|
||||||
|
|
||||||
|
@ -775,7 +785,7 @@ kolab_files_list_select = function(list)
|
||||||
if (selected == 1) {
|
if (selected == 1) {
|
||||||
// get file mimetype
|
// get file mimetype
|
||||||
var type = $('tr.selected', list.list).data('type');
|
var type = $('tr.selected', list.list).data('type');
|
||||||
rcmail.env.viewer = file_api.file_type_supported(type);
|
rcmail.env.viewer = file_api.file_type_supported(type, rcmail.env.files_caps);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rcmail.env.viewer = 0;
|
rcmail.env.viewer = 0;
|
||||||
|
@ -791,7 +801,7 @@ kolab_files_list_select = function(list)
|
||||||
rcmail.enable_command('files-open', rcmail.env.viewer);
|
rcmail.enable_command('files-open', rcmail.env.viewer);
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_list_keypress = function(list)
|
function kolab_files_list_keypress(list)
|
||||||
{
|
{
|
||||||
if (list.modkey == CONTROL_KEY)
|
if (list.modkey == CONTROL_KEY)
|
||||||
return;
|
return;
|
||||||
|
@ -802,7 +812,7 @@ kolab_files_list_keypress = function(list)
|
||||||
rcmail.command('files-delete');
|
rcmail.command('files-delete');
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_drag_start = function(e)
|
function kolab_files_drag_start(e)
|
||||||
{
|
{
|
||||||
rcmail.env.drag_target = null;
|
rcmail.env.drag_target = null;
|
||||||
|
|
||||||
|
@ -810,7 +820,7 @@ kolab_files_drag_start = function(e)
|
||||||
rcmail.folder_list.drag_start();
|
rcmail.folder_list.drag_start();
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_drag_end = function(e)
|
function kolab_files_drag_end(e)
|
||||||
{
|
{
|
||||||
if (rcmail.folder_list) {
|
if (rcmail.folder_list) {
|
||||||
rcmail.folder_list.drag_end();
|
rcmail.folder_list.drag_end();
|
||||||
|
@ -832,7 +842,7 @@ kolab_files_drag_end = function(e)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_drag_move = function(e)
|
function kolab_files_drag_move(e)
|
||||||
{
|
{
|
||||||
if (rcmail.folder_list) {
|
if (rcmail.folder_list) {
|
||||||
var mouse = rcube_event.get_mouse_pos(e);
|
var mouse = rcube_event.get_mouse_pos(e);
|
||||||
|
@ -841,7 +851,7 @@ kolab_files_drag_move = function(e)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_drag_menu_action = function(command)
|
function kolab_files_drag_menu_action(command)
|
||||||
{
|
{
|
||||||
var menu = rcmail.gui_objects.file_dragmenu;
|
var menu = rcmail.gui_objects.file_dragmenu;
|
||||||
|
|
||||||
|
@ -851,7 +861,7 @@ kolab_files_drag_menu_action = function(command)
|
||||||
rcmail.command(command, rcmail.env.drag_target);
|
rcmail.command(command, rcmail.env.drag_target);
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_selected = function()
|
function kolab_files_selected()
|
||||||
{
|
{
|
||||||
var files = [];
|
var files = [];
|
||||||
$.each(rcmail.file_list.get_selection(), function(i, v) {
|
$.each(rcmail.file_list.get_selection(), function(i, v) {
|
||||||
|
@ -864,11 +874,14 @@ kolab_files_selected = function()
|
||||||
return files;
|
return files;
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_frame_load = function(frame)
|
function kolab_files_frame_load(frame)
|
||||||
{
|
{
|
||||||
var win = frame.contentWindow;
|
var win = frame.contentWindow;
|
||||||
|
|
||||||
|
try {
|
||||||
rcmail.file_editor = win.file_editor && win.file_editor.editable ? win.file_editor : null;
|
rcmail.file_editor = win.file_editor && win.file_editor.editable ? win.file_editor : null;
|
||||||
|
}
|
||||||
|
catch (e) {};
|
||||||
|
|
||||||
if (rcmail.file_editor)
|
if (rcmail.file_editor)
|
||||||
rcmail.enable_command('files-edit', true);
|
rcmail.enable_command('files-edit', true);
|
||||||
|
@ -885,7 +898,7 @@ kolab_files_frame_load = function(frame)
|
||||||
};
|
};
|
||||||
|
|
||||||
// activate html5 file drop feature (if browser supports it)
|
// activate html5 file drop feature (if browser supports it)
|
||||||
kolab_files_drag_drop_init = function(container)
|
function kolab_files_drag_drop_init(container)
|
||||||
{
|
{
|
||||||
if (!window.FormData && !(window.XMLHttpRequest && XMLHttpRequest.prototype && XMLHttpRequest.prototype.sendAsBinary)) {
|
if (!window.FormData && !(window.XMLHttpRequest && XMLHttpRequest.prototype && XMLHttpRequest.prototype.sendAsBinary)) {
|
||||||
return;
|
return;
|
||||||
|
@ -916,7 +929,7 @@ kolab_files_drag_drop_init = function(container)
|
||||||
};
|
};
|
||||||
|
|
||||||
// handler for drag/drop on element
|
// handler for drag/drop on element
|
||||||
kolab_files_drag_hover = function(e)
|
function kolab_files_drag_hover(e)
|
||||||
{
|
{
|
||||||
if (!file_api.env.folder)
|
if (!file_api.env.folder)
|
||||||
return;
|
return;
|
||||||
|
@ -933,7 +946,7 @@ kolab_files_drag_hover = function(e)
|
||||||
};
|
};
|
||||||
|
|
||||||
// returns localized file size
|
// returns localized file size
|
||||||
kolab_files_file_size = function(size)
|
function kolab_files_file_size(size)
|
||||||
{
|
{
|
||||||
var i, units = ['GB', 'MB', 'KB', 'B'];
|
var i, units = ['GB', 'MB', 'KB', 'B'];
|
||||||
|
|
||||||
|
@ -946,7 +959,7 @@ kolab_files_file_size = function(size)
|
||||||
return size;
|
return size;
|
||||||
};
|
};
|
||||||
|
|
||||||
kolab_files_progress_str = function(param)
|
function kolab_files_progress_str(param)
|
||||||
{
|
{
|
||||||
var current, total = file_api.file_size(param.total).toUpperCase();
|
var current, total = file_api.file_size(param.total).toUpperCase();
|
||||||
|
|
||||||
|
@ -968,6 +981,30 @@ kolab_files_progress_str = function(param)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************/
|
||||||
|
/********* Manticore editor functionality **********/
|
||||||
|
/**********************************************************/
|
||||||
|
|
||||||
|
// Initialize document toolbar functionality
|
||||||
|
function manticore_init()
|
||||||
|
{
|
||||||
|
rcmail.enable_command('document-save', 'document-export', true);
|
||||||
|
|
||||||
|
// Populate document export menu with supported file types
|
||||||
|
manticore.export_menu($('ul', rcmail.gui_objects.exportmenu));
|
||||||
|
};
|
||||||
|
|
||||||
|
rcube_webmail.prototype.document_save = function()
|
||||||
|
{
|
||||||
|
manticore.save();
|
||||||
|
};
|
||||||
|
|
||||||
|
rcube_webmail.prototype.document_export = function(type)
|
||||||
|
{
|
||||||
|
manticore.export(type || 'odt');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
/********** Commands **********/
|
/********** Commands **********/
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
@ -2556,7 +2593,7 @@ function kolab_files_ui()
|
||||||
// open file in new window, using file API viewer
|
// open file in new window, using file API viewer
|
||||||
this.file_open = function(file, viewer)
|
this.file_open = function(file, viewer)
|
||||||
{
|
{
|
||||||
var href = '?' + $.param({_task: 'files', _action: 'open', file: file, viewer: viewer == 2 ? 1 : 0});
|
var href = '?' + $.param({_task: 'files', _action: 'open', file: file, viewer: viewer || 0});
|
||||||
rcmail.open_window(href, false, true);
|
rcmail.open_window(href, false, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -881,13 +881,14 @@ class kolab_files_engine
|
||||||
protected function action_open()
|
protected function action_open()
|
||||||
{
|
{
|
||||||
$file = rcube_utils::get_input_value('file', rcube_utils::INPUT_GET);
|
$file = rcube_utils::get_input_value('file', rcube_utils::INPUT_GET);
|
||||||
|
$viewer = intval($_GET['viewer']);
|
||||||
|
|
||||||
// get file info
|
// get file info
|
||||||
$token = $this->get_api_token();
|
$token = $this->get_api_token();
|
||||||
$request = $this->get_request(array(
|
$request = $this->get_request(array(
|
||||||
'method' => 'file_info',
|
'method' => 'file_info',
|
||||||
'file' => $file,
|
'file' => $file,
|
||||||
'viewer' => !empty($_GET['viewer']),
|
'viewer' => $viewer,
|
||||||
), $token);
|
), $token);
|
||||||
|
|
||||||
// send request to the API
|
// send request to the API
|
||||||
|
@ -925,7 +926,7 @@ class kolab_files_engine
|
||||||
$this->rc->output->set_env('file', $file);
|
$this->rc->output->set_env('file', $file);
|
||||||
$this->rc->output->set_env('file_data', $this->file_data);
|
$this->rc->output->set_env('file_data', $this->file_data);
|
||||||
$this->rc->output->set_pagetitle(rcube::Q($file));
|
$this->rc->output->set_pagetitle(rcube::Q($file));
|
||||||
$this->rc->output->send('kolab_files.filepreview');
|
$this->rc->output->send('kolab_files.' . ($viewer & 4 ? 'docedit' : 'filepreview'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,6 +36,11 @@
|
||||||
background-position: center -93px;
|
background-position: center -93px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#filestoolbar a.button.export {
|
||||||
|
background-position: 0 -93px;
|
||||||
|
min-width: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
#filestoolbar a.button.open {
|
#filestoolbar a.button.open {
|
||||||
background-position: center -131px;
|
background-position: center -131px;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +93,10 @@
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#filecontent.docedit {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
#filelistbox {
|
#filelistbox {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
49
plugins/kolab_files/skins/larry/templates/docedit.html
Normal file
49
plugins/kolab_files/skins/larry/templates/docedit.html
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<roundcube:object name="doctype" value="html5" />
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title><roundcube:object name="pagetitle" /></title>
|
||||||
|
<roundcube:include file="/includes/links.html" />
|
||||||
|
<script src="plugins/kolab_files/skins/larry/ui.js" type="text/javascript"></script>
|
||||||
|
</head>
|
||||||
|
<body class="files noscroll extwin">
|
||||||
|
|
||||||
|
<roundcube:include file="/includes/header.html" />
|
||||||
|
|
||||||
|
<div id="mainscreen">
|
||||||
|
|
||||||
|
<h1 class="voice"><roundcube:label name="kolab_files.docedit" /></h1>
|
||||||
|
|
||||||
|
<h2 id="aria-label-toolbar" class="voice"><roundcube:label name="arialabeltoolbar" /></h2>
|
||||||
|
<div id="filestoolbar" class="toolbar" role="toolbar" aria-labelledby="aria-label-toolbar">
|
||||||
|
<roundcube:button command="files-delete" type="link" class="button delete disabled" classAct="button delete" classSel="button delete pressed" label="delete" title="kolab_files.deletefile" />
|
||||||
|
<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>
|
||||||
|
</span>
|
||||||
|
<!--
|
||||||
|
<roundcube:button command="document-print" type="link" class="button print disabled" classAct="button print" classSel="button print pressed" label="print" title="kolab_files.printfile" />
|
||||||
|
-->
|
||||||
|
<roundcube:button command="document-save" type="link" class="button save disabled" classAct="button save" classSel="button save pressed" label="kolab_files.save" title="kolab_files.savefile" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="filecontent" class="uibox docedit">
|
||||||
|
<div class="iframebox">
|
||||||
|
<roundcube:object name="filepreviewframe" id="fileframe" frameborder="0" title="kolab_files.arialabelfilecontent" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="exportmenu" class="popupmenu" aria-hidden="true">
|
||||||
|
<h3 id="aria-label-exportmenu" class="voice"><roundcube:label name="kolab_files.arialabelexportoptions" /></h3>
|
||||||
|
<ul id="exportmenu-menu" class="toolbarmenu" role="menu" aria-labelledby="aria-label-exportmenu"></ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<roundcube:include file="/includes/footer.html" />
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
kolab_files_ui_init();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -5,6 +5,9 @@ function kolab_files_ui_init()
|
||||||
orientation:'v', relative:true, start:226, min:150, size:12 }).init();
|
orientation:'v', relative:true, start:226, min:150, size:12 }).init();
|
||||||
|
|
||||||
rcmail.addEventListener('enable-command', kolab_files_enable_command);
|
rcmail.addEventListener('enable-command', kolab_files_enable_command);
|
||||||
|
|
||||||
|
if ($('#exportmenu').length)
|
||||||
|
rcmail.gui_object('exportmenu', 'exportmenu');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
var filesviewsplit = new rcube_splitter({ id:'filesviewsplitter', p1:'#folderlistbox', p2:'#filelistcontainer',
|
var filesviewsplit = new rcube_splitter({ id:'filesviewsplitter', p1:'#folderlistbox', p2:'#filelistcontainer',
|
||||||
|
|
Loading…
Add table
Reference in a new issue