summaryrefslogtreecommitdiff
path: root/plugins/kolab_notes
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-10-13 13:34:10 (GMT)
committerThomas Bruederli <bruederli@kolabsys.com>2014-10-13 13:34:10 (GMT)
commitff139fe6627102033dc54c2ab7894b85e028e452 (patch)
treeb4fac199d2eb398c7ccb1330ca4f6ba548617c02 /plugins/kolab_notes
parent44c2639cbeb9bf612d178515c4db2bff0235a38d (diff)
downloadroundcubemail-plugins-kolab-ff139fe6627102033dc54c2ab7894b85e028e452.tar.gz
Allow to delete email message links from notes
Diffstat (limited to 'plugins/kolab_notes')
-rw-r--r--plugins/kolab_notes/kolab_notes.php3
-rw-r--r--plugins/kolab_notes/kolab_notes_ui.php2
-rw-r--r--plugins/kolab_notes/localization/en_US.inc1
-rw-r--r--plugins/kolab_notes/notes.js34
-rw-r--r--plugins/kolab_notes/skins/larry/notes.css12
5 files changed, 43 insertions, 9 deletions
diff --git a/plugins/kolab_notes/kolab_notes.php b/plugins/kolab_notes/kolab_notes.php
index 369f1c5..4def121 100644
--- a/plugins/kolab_notes/kolab_notes.php
+++ b/plugins/kolab_notes/kolab_notes.php
@@ -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);
diff --git a/plugins/kolab_notes/kolab_notes_ui.php b/plugins/kolab_notes/kolab_notes_ui.php
index 1726980..bb13813 100644
--- a/plugins/kolab_notes/kolab_notes_ui.php
+++ b/plugins/kolab_notes/kolab_notes_ui.php
@@ -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)
diff --git a/plugins/kolab_notes/localization/en_US.inc b/plugins/kolab_notes/localization/en_US.inc
index 939946c..19d4139 100644
--- a/plugins/kolab_notes/localization/en_US.inc
+++ b/plugins/kolab_notes/localization/en_US.inc
@@ -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';
diff --git a/plugins/kolab_notes/notes.js b/plugins/kolab_notes/notes.js
index 09813fe..5a9e05f 100644
--- a/plugins/kolab_notes/notes.js
+++ b/plugins/kolab_notes/notes.js
@@ -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);
}
-*/
});
}
@@ -939,6 +942,19 @@ function rcube_kolab_notes_ui(settings)
}
/**
+ *
+ */
+ 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
*/
function print_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;
}
/**
diff --git a/plugins/kolab_notes/skins/larry/notes.css b/plugins/kolab_notes/skins/larry/notes.css
index 24daa9d..1937da6 100644
--- a/plugins/kolab_notes/skins/larry/notes.css
+++ b/plugins/kolab_notes/skins/larry/notes.css
@@ -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 {