Allow to delete email message links from notes
This commit is contained in:
parent
44c2639cbe
commit
ff139fe662
5 changed files with 43 additions and 9 deletions
|
@ -998,6 +998,9 @@ class kolab_notes extends rcube_plugin
|
|||
|
||||
private function save_links($uid, $links)
|
||||
{
|
||||
if (empty($links)) {
|
||||
$links = array();
|
||||
}
|
||||
$config = kolab_storage_config::get_instance();
|
||||
$remove = array_diff($config->get_object_links($uid), $links);
|
||||
return $config->save_object_links($uid, $links, $remove);
|
||||
|
|
|
@ -102,7 +102,7 @@ class kolab_notes_ui
|
|||
|
||||
$this->rc->output->set_env('kolab_notes_settings', $settings);
|
||||
|
||||
$this->rc->output->add_label('save','cancel');
|
||||
$this->rc->output->add_label('save','cancel','delete');
|
||||
}
|
||||
|
||||
public function folders($attrib)
|
||||
|
|
|
@ -34,6 +34,7 @@ $labels['listsearchresults'] = 'Additional notebooks';
|
|||
$labels['nrnotebooksfound'] = '$nr notebooks found';
|
||||
$labels['nonotebooksfound'] = 'No notebooks found';
|
||||
$labels['removelist'] = 'Remove from list';
|
||||
$labels['removelink'] = 'Remove email reference';
|
||||
|
||||
$labels['savingdata'] = 'Saving data...';
|
||||
$labels['recordnotfound'] = 'Record not found';
|
||||
|
|
|
@ -842,16 +842,19 @@ function rcube_kolab_notes_ui(settings)
|
|||
.text(link.subject || link.uri)
|
||||
)
|
||||
.appendTo(attachmentslist);
|
||||
/*
|
||||
|
||||
if (!readonly && !data._from_mail) {
|
||||
$('<a>')
|
||||
.attr('href', '#delete')
|
||||
.attr('title', rcmail.gettext('delete'))
|
||||
.attr('title', rcmail.gettext('removelink', 'kolab_notes'))
|
||||
.addClass('delete')
|
||||
.html(rcmail.gettext('delete'))
|
||||
.click({ uri:link.uri }, function(e) {
|
||||
remove_link(this, e.data.uri);
|
||||
return false;
|
||||
})
|
||||
.appendTo(li);
|
||||
}
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -938,6 +941,19 @@ function rcube_kolab_notes_ui(settings)
|
|||
return '<pre>' + Q(str).replace(link_pattern, link_replace) + '</pre>';
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function remove_link(elem, uri)
|
||||
{
|
||||
// remove the link item matching the given uri
|
||||
me.selected_note.links = $.grep(me.selected_note.links, function(link) { return link.uri != uri; });
|
||||
me.selected_note._links_removed = true
|
||||
|
||||
// remove UI list item
|
||||
$(elem).hide().closest('li').addClass('deleted');
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a new window to print the currently selected note
|
||||
*/
|
||||
|
@ -1134,10 +1150,6 @@ function rcube_kolab_notes_ui(settings)
|
|||
|
||||
var savedata = get_save_data();
|
||||
|
||||
// copy links as they're yet immutable
|
||||
if (me.selected_note.links)
|
||||
savedata.links = me.selected_note.links;
|
||||
|
||||
// add reference to old list if changed
|
||||
if (me.selected_note.list && savedata.list != me.selected_note.list) {
|
||||
savedata._fromlist = me.selected_note.list;
|
||||
|
@ -1175,6 +1187,11 @@ function rcube_kolab_notes_ui(settings)
|
|||
tags: []
|
||||
};
|
||||
|
||||
// copy links
|
||||
if ($.isArray(me.selected_note.links)) {
|
||||
savedata.links = me.selected_note.links;
|
||||
}
|
||||
|
||||
// collect tags
|
||||
$('.tagedit-list input[type="hidden"]', rcmail.gui_objects.noteviewtitle).each(function(i, elem){
|
||||
if (elem.value)
|
||||
|
@ -1203,7 +1220,8 @@ function rcube_kolab_notes_ui(settings)
|
|||
return savedata.title != me.selected_note.title
|
||||
|| savedata.description != me.selected_note.description
|
||||
|| savedata.tags.join(',') != (me.selected_note.tags || []).join(',')
|
||||
|| savedata.list != me.selected_note.list;
|
||||
|| savedata.list != me.selected_note.list
|
||||
|| me.selected_note._links_removed;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -530,14 +530,26 @@
|
|||
}
|
||||
|
||||
.notesview .attachmentslist li.message.eml {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
background-image: url(sprites.png);
|
||||
background-position: -6px -128px;
|
||||
margin-right: 1em;
|
||||
padding-right: 28px;
|
||||
}
|
||||
|
||||
.notesview .attachmentslist li.message a.messagelink {
|
||||
padding-left: 24px;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.notesview .attachmentslist li.message a.delete {
|
||||
background-position: -6px -378px;
|
||||
}
|
||||
|
||||
.notesview .attachmentslist li.deleted a.messagelink,
|
||||
.notesview .attachmentslist li.deleted a.messagelink:hover {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
ul.toolbarmenu li .appendnote span.icon {
|
||||
|
|
Loading…
Add table
Reference in a new issue