Elastic: Document editing and some other fixes

This commit is contained in:
Aleksander Machniak 2018-04-23 14:08:52 +00:00
parent 0e5a0648e1
commit 361837cfee
8 changed files with 196 additions and 50 deletions

View file

@ -787,13 +787,12 @@ function kolab_files_file_create_dialog(file)
// file session dialog
function kolab_files_session_dialog(session)
{
var buttons = {},
var buttons = {}, button_classes = [],
dialog = $('#files-session-dialog'),
filename = file_api.file_name(session.file),
owner = session.owner_name || session.owner,
title = rcmail.gettext('kolab_files.sessiondialog'),
content = rcmail.gettext('kolab_files.sessiondialogcontent'),
button_classes = ['mainaction edit'],
join_session = function(id) {
var viewer = file_api.file_type_supported('application/vnd.oasis.opendocument.text', rcmail.env.files_caps);
params = {action: 'edit', session: id};
@ -813,19 +812,19 @@ function kolab_files_session_dialog(session)
kolab_dialog_close(this);
file_api.document_delete(session.id);
};
button_classes.push('delete');
button_classes = ['mainaction edit', 'delete'];
}
else if (session.is_invited) {
button_classes = ['mainaction edit'];
// @TODO: check if not-accepted and provide "Decline invitation" button
// @TODO: Add "Accept button", add comment field to the dialog
button_classes.push('session join');
buttons[rcmail.gettext('kolab_files.join')] = function() {
kolab_dialog_close(this);
join_session(session.id);
};
}
else {
button_classes.push('session request');
button_classes = ['mainaction session request'];
buttons[rcmail.gettext('kolab_files.request')] = function() {
kolab_dialog_close(this);
// @TODO: Add comment field to the dialog
@ -1150,7 +1149,8 @@ function kolab_files_drag_end(e)
if (menu && modkey == SHIFT_KEY && rcmail.commands['files-copy']) {
var pos = rcube_event.get_mouse_pos(e);
$(menu).css({top: (pos.y-10)+'px', left: (pos.x-10)+'px'}).show();
rcmail.show_menu(menu.id, true, e);
$(menu).css({top: (pos.y-10)+'px', left: (pos.x-10)+'px'});
return;
}
@ -3160,7 +3160,7 @@ function kolab_files_ui()
// or overwrite destination file(s)
this.file_move_ask_user = function(list, move)
{
var file = list[0], buttons = {}, button_classes = ['save file overwrite'],
var file = list[0], buttons = {}, button_classes = ['mainaction save file overwrite'],
text = rcmail.gettext('kolab_files.filemoveconfirm').replace('$file', file.dst),
dialog = $('<div></div>');
@ -3178,7 +3178,7 @@ function kolab_files_ui()
};
if (list.length > 1) {
button_classes.push('file overwrite all');
button_classes.push('save file overwrite all');
buttons[rcmail.gettext('kolab_files.fileoverwriteall')] = function() {
var f = {}, action = move ? 'file_move' : 'file_copy';
@ -3203,18 +3203,21 @@ function kolab_files_ui()
button_classes.push('cancel file skip');
buttons[rcmail.gettext('kolab_files.fileskip')] = skip_func;
if (list.length > 1)
if (list.length > 1) {
button_classes.push('cancel file skip all');
buttons[rcmail.gettext('kolab_files.fileskipall')] = function() {
kolab_dialog_close(this, true);
if (move)
file_api.file_list();
};
}
// open jquery UI dialog
kolab_dialog_show(dialog.html(text), {
title: rcmail.gettext('confirmationtitle'),
close: skip_func,
buttons: buttons,
button_classes: button_classes,
height: 50,
minWidth: 400,
width: 400

View file

@ -387,28 +387,29 @@ class kolab_files_engine
*/
public function document_editors_dialog($attrib)
{
$table = new html_table(array('cols' => 3, 'border' => 0, 'cellpadding' => 0, 'class' => 'records-table'));
$table = new html_table($attrib + array('cols' => 3, 'border' => 0, 'cellpadding' => 0));
$table->add_header('username', $this->plugin->gettext('participant'));
$table->add_header('status', $this->plugin->gettext('status'));
$table->add_header('options', null);
$input = new html_inputfield(array('name' => 'participant', 'id' => 'invitation-editor-name', 'size' => 30));
$input = new html_inputfield(array('name' => 'participant', 'id' => 'invitation-editor-name', 'size' => 30, 'class' => 'form-control'));
$textarea = new html_textarea(array('name' => 'comment', 'id' => 'invitation-comment',
'rows' => 4, 'cols' => 55, 'title' => $this->plugin->gettext('invitationtexttitle')));
$button = new html_inputfield(array('type' => 'button', 'class' => 'button', 'id' => 'invitation-editor-add', 'value' => $this->plugin->gettext('addparticipant')));
'rows' => 4, 'cols' => 55, 'class' => 'form-control', 'title' => $this->plugin->gettext('invitationtexttitle')));
$button = new html_inputfield(array('type' => 'button', 'class' => 'button', 'id' => 'invitation-editor-add',
'value' => $this->plugin->gettext('addparticipant')));
$this->plugin->add_label('manageeditors', 'statusorganizer');
$this->plugin->add_label('manageeditors', 'statusorganizer', 'addparticipant');
// initialize attendees autocompletion
$this->rc->autocomplete_init();
return '<div>' . $table->show() . html::div(null,
html::div(null, $input->show() . " " . $button->show())
return html::div(null, $table->show() . html::div(null,
html::div('form-searchbar', $input->show() . " " . $button->show())
. html::p('attendees-commentbox', html::label(null,
$this->plugin->gettext('invitationtextlabel') . $textarea->show())
)
) . '</div>';
));
}
/**

View file

@ -2,9 +2,12 @@
<h1 class="voice"><roundcube:var name="env:filename" /></h1>
<div class="content selected <roundcube:var name="env:editor_type" />">
<div class="content selected editor-<roundcube:var name="env:editor_type" />">
<h2 id="aria-label-toolbar" class="voice"><roundcube:label name="arialabeltoolbar" /></h2>
<div class="header" role="toolbar" aria-labelledby="aria-label-toolbar">
<div class="header document-editor-header" role="toolbar" aria-labelledby="aria-label-toolbar">
<a class="button icon members" href="#members" onclick="kolab_files_members_list(this)" data-hidden="big">
<span class="inner"><roundcube:label name="kolab_files.arialabelcollaborators"></span>
</a>
<span class="header-title constant"><roundcube:var name="env:filename" /></span>
<div class="toolbar">
<roundcube:button command="document-close" type="link"
@ -21,25 +24,24 @@
<roundcube:if condition="env:editor_type == 'wopi'" />
<roundcube:button command="document-print" type="link"
class="button print disabled" classAct="button print"
label="print" title="kolab_files.printfile" innerClass="inner" />
label="print" title="kolab_files.printfile" innerClass="inner" data-hidden="small" />
<roundcube:endif />
<roundcube:button command="document-save" type="link"
class="button save disabled" classAct="button save"
label="kolab_files.save" title="kolab_files.savefile" innerClass="inner" />
<!--
<roundcube:if condition="env:editor_type != 'wopi'" />
<span class="spacer"></span>
<label for="document-title"><roundcube:label name="kolab_files.documenttitle" />&nbsp;<input id="document-title" type="text" value="" /></label>
<roundcube:endif />
-->
</div>
<!--
<h3 id="aria-label-collaborators" class="voice"><roundcube:label name="kolab_files.arialabelcollaborators" /></h3>
<div id="collaborators" class="toolbar" role="toolbar" aria-labelledby="aria-label-collaborators">
<roundcube:button command="document-editors" type="link" class="button add disabled" classAct="button add" classSel="button add pressed" content=" " title="kolab_files.manageeditors" />
<div id="members"></div>
<roundcube:if condition="env:editor_type != 'wopi'" />
<div id="doc-title" data-hidden="small">
<label for="document-title"><roundcube:label name="kolab_files.documenttitle" />&nbsp;<input id="document-title" type="text" class="form-control" /></label>
</div>
<roundcube:endif />
<div id="collaborators" role="toolbar" aria-labelledby="aria-label-collaborators" data-hidden="small">
<h3 id="aria-label-collaborators" class="voice"><roundcube:label name="kolab_files.arialabelcollaborators" /></h3>
<roundcube:button command="document-editors" type="link"
class="button add disabled" classAct="button add"
label="kolab_files.manageeditors" title="kolab_files.manageeditors" innerClass="inner" />
<div id="members" class="session-members"></div>
</div>
-->
</div>
<h2 id="aria-label-filecontent" class="voice"><roundcube:label name="kolab_files.arialabelfilecontent" /></h2>
<div class="iframe-wrapper">
@ -53,9 +55,9 @@
<ul id="exportmenu-menu" class="toolbarmenu listing" role="menu" aria-labelledby="aria-label-exportmenu"></ul>
</div>
<div id="document-editors-dialog" class="popupmenu" data-editable="true" role="dialog" aria-labelledby="aria-label-doceditorsdialog">
<div id="document-editors-dialog" class="popupmenu editors-dialog" data-editable="true" role="dialog" aria-labelledby="aria-label-doceditorsdialog">
<h3 id="aria-label-doceditorsdialog" class="voice"><roundcube:label name="kolab_files.arialabeldoceditorsdialog" /></h3>
<roundcube:object name="document-editors-dialog" />
<roundcube:object name="document-editors-dialog" class="records-table table no-img" />
</div>
<script src="plugins/kolab_files/skins/elastic/ui.js" type="text/javascript"></script>

View file

@ -32,7 +32,7 @@
label="delete" title="kolab_files.deletefile" innerClass="inner" />
<roundcube:button command="files-print" type="link"
class="button print disabled" classAct="button print"
label="print" title="kolab_files.printfile" innerClass="inner" />
label="print" title="kolab_files.printfile" innerClass="inner" data-hidden="small" />
<roundcube:if condition="stripos(env:mimetype, 'image/') === 0" />
<roundcube:button command="image-scale" type="link" prop="+" data-hidden="small"
class="button zoomin disabled" classAct="button zoomin"

View file

@ -39,12 +39,40 @@ function kolab_files_listoptions(type)
});
};
function kolab_files_members_list(link)
{
var dialog = $('<div id="members-dialog" class="session-members"><ul></ul></div>'),
title = $(link).text(),
add_button = $('#collaborators a.button.add'),
save_func = function(e) {
add_button.click();
return true;
};
if (rcmail.env.action == 'open' || rcmail.env.action == 'edit') {
if (add_button.is('.disabled')) {
save_func = null;
}
$('#members img').each(function() {
var cloned = $(this).clone();
$('<li>').append(cloned).append($('<span>').text(this.title))
.appendTo(dialog.find('ul'));
});
dialog = rcmail.simple_dialog(dialog, title, save_func, {
closeOnEscape: true,
width: 400,
button: 'kolab_files.addparticipant',
button_class: 'participant add',
cancel_button: 'close'
});
};
if (rcmail.env.action == 'open') {
rcmail.addEventListener('enable-command', kolab_files_enable_command);
if ($('#exportmenu').length)
rcmail.gui_object('exportmenu', 'exportmenu');
$('#toolbar-menu a.button.save').parent().hide();
// center and scale the image in preview frame
if (rcmail.env.mimetype.startsWith('image/')) {
@ -56,6 +84,9 @@ if (rcmail.env.action == 'open' || rcmail.env.action == 'edit') {
});
}
}
else if (rcmail.env.action == 'edit') {
rcmail.gui_object('exportmenu', 'export-menu');
}
else {
rcmail.addEventListener('files-folder-select', function(p) {
var is_sess = p.folder == 'folder-collection-sessions';
@ -68,9 +99,6 @@ else {
}
$(document).ready(function() {
$('#toolbar-menu a.button.save').parent().hide();
if ($('#dragfilemenu').length) {
rcmail.gui_object('file_dragmenu', 'dragfilemenu');
}

View file

@ -54,7 +54,7 @@
<div id="document-editors-dialog" class="uidialog" data-editable="true" role="dialog" aria-labelledby="aria-label-doceditorsdialog" aria-hidden="true">
<h3 id="aria-label-doceditorsdialog" class="voice"><roundcube:label name="kolab_files.arialabeldoceditorsdialog" /></h3>
<roundcube:object name="document-editors-dialog" />
<roundcube:object name="document-editors-dialog" class="records-table" />
</div>
<roundcube:include file="/includes/footer.html" />

View file

@ -676,14 +676,6 @@ function rcube_libcalendaring(settings)
this.alarm_dialog = $('<div>').attr('id', 'alarm-display').append(records);
buttons.push({
text: rcmail.gettext('close'),
click: function() {
$(this).dialog('close');
},
'class': 'cancel'
});
buttons.push({
text: rcmail.gettext('dismissall','libcalendaring'),
click: function(e) {
@ -694,6 +686,14 @@ function rcube_libcalendaring(settings)
'class': 'delete'
});
buttons.push({
text: rcmail.gettext('close'),
click: function() {
$(this).dialog('close');
},
'class': 'cancel'
});
this.alarm_dialog.appendTo(document.body).dialog({
modal: true,
resizable: true,

View file

@ -111,6 +111,21 @@ a.button.saveas:before {
position: relative;
}
#filelistbox {
height: 100%;
&.droptarget {
&.active {
box-shadow: 0 0 2px 1px darken(@color-toolbar-button-background-hover, 20%) inset;
}
&.hover {
box-shadow: 0 0 2px 1px darken(@color-toolbar-button-background-hover, 20%) inset;
background-color: @color-toolbar-button-background-hover;
}
}
}
.filelist {
thead {
display: none;
@ -349,3 +364,100 @@ a.button.saveas:before {
}
}
}
.document-editor-header {
.toolbar {
text-align: left !important;
}
a.button.icon.members:before {
content: @fa-var-users;
}
#collaborators {
order: 9;
display: flex;
margin-right: .5rem;
a.button.add:before {
&:extend(.font-icon-class);
content: @fa-var-plus;
}
.inner {
display: none;
}
}
#doc-title {
flex: 1;
order: 8;
input {
display: inline;
}
}
}
.session-members {
img.photo {
width: 32px;
height: 32px;
overflow: hidden;
background: url(../../../../skins/elastic/images/contactpic.png) center center no-repeat #fff;
background-size: cover;
border-radius: .25rem;
border: solid 3px #eee;
margin-left: .5rem;
}
ul {
padding: 0;
margin: 0;
list-style-type: none;
li {
display: flex;
align-items: center;
}
img.photo {
width: 48px;
height: 48px;
min-width: 48px;
margin-left: 0;
margin-right: 1em;
}
}
}
.editors-dialog {
table {
th {
border: 0;
}
tr:last-child td {
border-bottom: 1px solid @color-layout-border;
}
td.options {
width: 1%;
a.delete:before {
&:extend(.font-icon-class);
content: @fa-var-trash-alt;
display: inline;
line-height: 1;
}
}
}
label {
display: block;
}
}
button.participant.add:before {
content: @fa-var-user-plus;
}