Support user names and comment for invitations (T859)
This commit is contained in:
parent
5b796290d6
commit
c9c5b19b52
2 changed files with 27 additions and 20 deletions
|
@ -170,7 +170,7 @@ function kolab_files_init()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rcmail.env.files_caps && rcmail.env.files_caps.MANTICORE)
|
if (rcmail.env.files_caps && rcmail.env.files_caps.MANTICORE && !rcmail.env.framed)
|
||||||
$.extend(manticore_config, {
|
$.extend(manticore_config, {
|
||||||
// invitation notifications
|
// invitation notifications
|
||||||
api: file_api,
|
api: file_api,
|
||||||
|
@ -186,10 +186,10 @@ function kolab_files_init()
|
||||||
gettext: function(label) { return rcmail.get_label('kolab_files.' + label); },
|
gettext: function(label) { return rcmail.get_label('kolab_files.' + label); },
|
||||||
set_busy: function(state, message) { return rcmail.set_busy(state, message ? 'kolab_files.' + message : ''); },
|
set_busy: function(state, message) { return rcmail.set_busy(state, message ? 'kolab_files.' + message : ''); },
|
||||||
hide_message: function(id) { return rcmail.hide_message(id); },
|
hide_message: function(id) { return rcmail.hide_message(id); },
|
||||||
display_message: function(label, type, is_txt) {
|
display_message: function(label, type, is_txt, timeout) {
|
||||||
if (!is_txt)
|
if (!is_txt)
|
||||||
label = 'kolab_files.' + label;
|
label = 'kolab_files.' + label;
|
||||||
return rcmail.display_message(label, type);
|
return rcmail.display_message(label, type, timeout * 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -584,14 +584,16 @@ function kolab_files_file_edit_dialog(file, sessions, readonly)
|
||||||
|
|
||||||
$.each(sessions, function() {
|
$.each(sessions, function() {
|
||||||
if (this.is_invited) {
|
if (this.is_invited) {
|
||||||
var txt = rcmail.gettext('kolab_files.invitedsession').replace('$user', this.owner);
|
var txt = rcmail.gettext('kolab_files.invitedsession')
|
||||||
|
.replace('$user', this.owner_name ? this.owner_name : this.owner);
|
||||||
items.push(item_fn(this.id, txt, 'invited'));
|
items.push(item_fn(this.id, txt, 'invited'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$.each(sessions, function() {
|
$.each(sessions, function() {
|
||||||
if (!this.is_owner && !this.is_invited) {
|
if (!this.is_owner && !this.is_invited) {
|
||||||
var txt = rcmail.gettext('kolab_files.joinsession').replace('$user', this.owner);
|
var txt = rcmail.gettext('kolab_files.joinsession')
|
||||||
|
.replace('$user', this.owner_name ? this.owner_name : this.owner);
|
||||||
items.push(item_fn(this.id, txt, 'request'));
|
items.push(item_fn(this.id, txt, 'request'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1193,7 +1195,8 @@ function kolab_files_editors_dialog(session)
|
||||||
{
|
{
|
||||||
var ac_props, items = [], buttons = {},
|
var ac_props, items = [], buttons = {},
|
||||||
info = rcmail.env.file_data,
|
info = rcmail.env.file_data,
|
||||||
dialog = $('#document-editors-dialog');
|
dialog = $('#document-editors-dialog'),
|
||||||
|
comment = $('#invitation-comment');
|
||||||
|
|
||||||
if (!info || !info.session || !info.session.is_owner)
|
if (!info || !info.session || !info.session.is_owner)
|
||||||
return;
|
return;
|
||||||
|
@ -1202,7 +1205,7 @@ function kolab_files_editors_dialog(session)
|
||||||
items.push(kolab_files_attendee_record(info.session.owner, 'organizer'));
|
items.push(kolab_files_attendee_record(info.session.owner, 'organizer'));
|
||||||
|
|
||||||
$.each(info.session.invitations || [], function(i, u) {
|
$.each(info.session.invitations || [], function(i, u) {
|
||||||
var record = kolab_files_attendee_record(u.user, u.status);
|
var record = kolab_files_attendee_record(u.user, u.status, u.user_name);
|
||||||
items.push(record);
|
items.push(record);
|
||||||
info.session.invitations[i].record = record;
|
info.session.invitations[i].record = record;
|
||||||
});
|
});
|
||||||
|
@ -1236,7 +1239,8 @@ function kolab_files_editors_dialog(session)
|
||||||
rcmail.addEventListener('autocomplete_insert', function(e) {
|
rcmail.addEventListener('autocomplete_insert', function(e) {
|
||||||
var success = false;
|
var success = false;
|
||||||
if (e.field.name == 'participant') {
|
if (e.field.name == 'participant') {
|
||||||
success = kolab_files_add_attendees(e.insert, 'invited', e.data && e.data.type == 'group' ? 'GROUP' : 'INDIVIDUAL');
|
// e.data && e.data.type == 'group' ? 'GROUP' : 'INDIVIDUAL'
|
||||||
|
success = kolab_files_add_attendees(e.insert, comment.val());
|
||||||
}
|
}
|
||||||
if (e.field && success) {
|
if (e.field && success) {
|
||||||
e.field.value = '';
|
e.field.value = '';
|
||||||
|
@ -1246,7 +1250,7 @@ function kolab_files_editors_dialog(session)
|
||||||
$('#invitation-editor-add').click(function() {
|
$('#invitation-editor-add').click(function() {
|
||||||
var input = $('#invitation-editor-name');
|
var input = $('#invitation-editor-name');
|
||||||
rcmail.ksearch_blur();
|
rcmail.ksearch_blur();
|
||||||
if (kolab_files_add_attendees(input.val(), 'invited', 'INDIVIDUAL')) {
|
if (kolab_files_add_attendees(input.val(), comment.val())) {
|
||||||
input.val('');
|
input.val('');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1254,7 +1258,7 @@ function kolab_files_editors_dialog(session)
|
||||||
};
|
};
|
||||||
|
|
||||||
// add the given list of participants
|
// add the given list of participants
|
||||||
function kolab_files_add_attendees(names)
|
function kolab_files_add_attendees(names, comment)
|
||||||
{
|
{
|
||||||
var i, item, success, email, name, attendees = {}, counter = 0;
|
var i, item, success, email, name, attendees = {}, counter = 0;
|
||||||
|
|
||||||
|
@ -1305,15 +1309,16 @@ function kolab_files_add_attendees(names)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter)
|
if (counter)
|
||||||
file_api.document_invite(rcmail.env.file_data.session.id, attendees);
|
file_api.document_invite(rcmail.env.file_data.session.id, attendees, comment);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
};
|
};
|
||||||
|
|
||||||
function kolab_files_attendee_record(user, status)
|
function kolab_files_attendee_record(user, status, username)
|
||||||
{
|
{
|
||||||
var options = [], select,
|
var options = [], select,
|
||||||
type = status ? status.replace(/-.*$/, '') : '',
|
type = status ? status.replace(/-.*$/, '') : '',
|
||||||
|
name = $('<td class="name">').text(user),
|
||||||
buttons = $('<td class="options">'),
|
buttons = $('<td class="options">'),
|
||||||
state = $('<td class="status">').text(rcmail.gettext('kolab_files.status' + type));
|
state = $('<td class="status">').text(rcmail.gettext('kolab_files.status' + type));
|
||||||
|
|
||||||
|
@ -1343,16 +1348,18 @@ function kolab_files_attendee_record(user, status)
|
||||||
.appendTo(buttons);
|
.appendTo(buttons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (username && status != 'organizer')
|
||||||
|
name.html($('<a>').attr({href: 'mailto:' + user, 'class': 'mailtolink'}).text(username))
|
||||||
|
.click(function(e) { rcmail.command('compose', user, e.target, e); return false; });
|
||||||
|
|
||||||
return $('<tr>').attr('class', 'invitation' + (type ? ' ' + type : ''))
|
return $('<tr>').attr('class', 'invitation' + (type ? ' ' + type : ''))
|
||||||
.append($('<td class="name">').text(user))
|
.append(name).append(state).append(buttons);
|
||||||
.append(state)
|
|
||||||
.append(buttons);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function manticore_invitation_handler(invitation)
|
function manticore_invitation_handler(invitation)
|
||||||
{
|
{
|
||||||
// make the "More" link clickable
|
// make the "More" link clickable
|
||||||
$('#' + invitation.id).click(function() { kolab_files_invitation_dialog(invitation); });
|
$('#' + invitation.id).parent('div').click(function() { kolab_files_invitation_dialog(invitation); });
|
||||||
|
|
||||||
// @todo: update session icon state on files list
|
// @todo: update session icon state on files list
|
||||||
};
|
};
|
||||||
|
@ -3256,7 +3263,7 @@ function kolab_files_ui()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Invite document session participants
|
// Invite document session participants
|
||||||
this.document_invite = function(id, attendees)
|
this.document_invite = function(id, attendees, comment)
|
||||||
{
|
{
|
||||||
var list = [];
|
var list = [];
|
||||||
|
|
||||||
|
@ -3265,7 +3272,7 @@ function kolab_files_ui()
|
||||||
|
|
||||||
if (list.length) {
|
if (list.length) {
|
||||||
this.req = this.set_busy(true, 'kolab_files.documentinviting');
|
this.req = this.set_busy(true, 'kolab_files.documentinviting');
|
||||||
this.request('document_invite', {id: id, users: list}, 'document_invite_response');
|
this.request('document_invite', {id: id, users: list, comment: comment || ''}, 'document_invite_response');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3279,7 +3286,7 @@ function kolab_files_ui()
|
||||||
table = $('#document-editors-dialog table > tbody');
|
table = $('#document-editors-dialog table > tbody');
|
||||||
|
|
||||||
$.each(response.result.list || {}, function() {
|
$.each(response.result.list || {}, function() {
|
||||||
var record = kolab_files_attendee_record(this.user, this.status);
|
var record = kolab_files_attendee_record(this.user, this.status, this.user_name);
|
||||||
table.append(record);
|
table.append(record);
|
||||||
if (info.session && info.session.invitations)
|
if (info.session && info.session.invitations)
|
||||||
info.session.invitations.push($.extend({status: 'invited', record: record}, this));
|
info.session.invitations.push($.extend({status: 'invited', record: record}, this));
|
||||||
|
|
|
@ -127,6 +127,7 @@ class kolab_files_engine
|
||||||
$this->plugin->include_script($this->url . '/js/files_api.js');
|
$this->plugin->include_script($this->url . '/js/files_api.js');
|
||||||
$this->plugin->include_script('kolab_files.js');
|
$this->plugin->include_script('kolab_files.js');
|
||||||
|
|
||||||
|
$this->rc->output->set_env('files_url', $this->url . '/api/');
|
||||||
$this->rc->output->set_env('files_token', $this->get_api_token());
|
$this->rc->output->set_env('files_token', $this->get_api_token());
|
||||||
$this->rc->output->set_env('files_caps', $_SESSION['kolab_files_caps']);
|
$this->rc->output->set_env('files_caps', $_SESSION['kolab_files_caps']);
|
||||||
$this->rc->output->set_env('files_user', $this->rc->get_user_name());
|
$this->rc->output->set_env('files_user', $this->rc->get_user_name());
|
||||||
|
@ -144,7 +145,6 @@ class kolab_files_engine
|
||||||
$collapsed_folders = (string) $this->rc->config->get('kolab_files_collapsed_folders');
|
$collapsed_folders = (string) $this->rc->config->get('kolab_files_collapsed_folders');
|
||||||
|
|
||||||
$this->rc->output->include_script('treelist.js');
|
$this->rc->output->include_script('treelist.js');
|
||||||
$this->rc->output->set_env('files_url', $this->url . '/api/');
|
|
||||||
$this->rc->output->set_env('kolab_files_collapsed_folders', $collapsed_folders);
|
$this->rc->output->set_env('kolab_files_collapsed_folders', $collapsed_folders);
|
||||||
|
|
||||||
// register template objects for dialogs (and main interface)
|
// register template objects for dialogs (and main interface)
|
||||||
|
|
Loading…
Add table
Reference in a new issue