summaryrefslogtreecommitdiff
path: root/skins
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-06 11:11:37 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-06 11:11:37 +0100
commitbc2c4380b5b754a3b13cc7d6663b2b81d2577e2e (patch)
tree7a3c360113d21a5f7c6d0e90b252ce5965dd3589 /skins
parentac37746c2ae187edaf38c7a660213e216f90b035 (diff)
Add attachment menu with Open and Download options (#1488975)
Diffstat (limited to 'skins')
-rw-r--r--skins/classic/functions.js53
-rw-r--r--skins/classic/mail.css20
-rw-r--r--skins/classic/templates/message.html8
-rw-r--r--skins/classic/templates/messagepreview.html12
-rw-r--r--skins/larry/images/buttons.gifbin13054 -> 14997 bytes
-rw-r--r--skins/larry/images/buttons.pngbin36693 -> 48308 bytes
-rw-r--r--skins/larry/mail.css2
-rw-r--r--skins/larry/styles.css13
-rw-r--r--skins/larry/templates/message.html8
-rw-r--r--skins/larry/templates/messagepreview.html8
-rw-r--r--skins/larry/ui.js42
11 files changed, 147 insertions, 19 deletions
diff --git a/skins/classic/functions.js b/skins/classic/functions.js
index c59ea9bf8..499783b3f 100644
--- a/skins/classic/functions.js
+++ b/skins/classic/functions.js
@@ -92,6 +92,7 @@ function rcube_mail_ui()
forwardmenu: {id:'forwardmenu', editable:1},
searchmenu: {id:'searchmenu', editable:1},
messagemenu: {id:'messagemenu'},
+ attachmentmenu: {id:'attachmentmenu'},
listmenu: {id:'listmenu', editable:1},
dragmessagemenu:{id:'dragmessagemenu', sticky:1},
groupmenu: {id:'groupoptionsmenu', above:1},
@@ -133,24 +134,24 @@ show_popupmenu: function(popup, show)
{
var obj = this.popups[popup].obj,
above = this.popups[popup].above,
- ref = rcube_find_object(popup+'link');
+ ref = $(this.popups[popup].link ? this.popups[popup].link : rcube_find_object(popup+'link'));
if (typeof show == 'undefined')
show = obj.is(':visible') ? false : true;
else if (this.popups[popup].toggle && show && this.popups[popup].obj.is(':visible') )
show = false;
- if (show && ref) {
- var parent = $(ref).parent(),
+ if (show && ref.length) {
+ var parent = ref.parent(),
win = $(window),
- pos = parent.hasClass('dropbutton') ? parent.offset() : $(ref).offset();
+ pos = parent.hasClass('dropbutton') ? parent.offset() : ref.offset();
- if (!above && pos.top + ref.offsetHeight + obj.height() > win.height())
+ if (!above && pos.top + ref.height() + obj.height() > win.height())
above = true;
if (pos.left + obj.width() > win.width())
pos.left = win.width() - obj.width() - 30;
- obj.css({ left:pos.left, top:(pos.top + (above ? -obj.height() : ref.offsetHeight)) });
+ obj.css({ left:pos.left, top:(pos.top + (above ? -obj.height() : ref.height())) });
}
obj[show?'show':'hide']();
@@ -325,7 +326,7 @@ listmenu: function(show)
};
},
-open_listmenu: function(e)
+open_listmenu: function()
{
this.listmenu();
},
@@ -380,6 +381,35 @@ spellmenu: function(show)
this.show_popupmenu('spellmenu', show);
},
+show_attachmentmenu: function(elem)
+{
+ var id = elem.parentNode.id.replace(/^attach/, '');
+
+ $('#attachmenuopen').unbind('click').attr('onclick', '').click(function(e) {
+ return rcmail.command('open-attachment', id, this);
+ });
+
+ $('#attachmenudownload').unbind('click').attr('onclick', '').click(function() {
+ rcmail.command('download-attachment', id, this);
+ });
+
+ this.popups.attachmentmenu.link = elem;
+ rcmail.command('menu-open', {menu: 'attachmentmenu', id: id});
+},
+
+menu_open: function(p)
+{
+ if (p && p.props && p.props.menu == 'attachmentmenu')
+ this.show_popup('attachmentmenu');
+ else
+ this.open_listmenu();
+},
+
+menu_save: function(prop)
+{
+ this.save_listmenu();
+},
+
body_mouseup: function(evt, p)
{
var i, target = rcube_event.get_target(evt);
@@ -800,8 +830,8 @@ function rcube_init_mail_ui()
.contents().mouseup(function(e){rcmail_ui.body_mouseup(e)});
if (rcmail.env.task == 'mail') {
- rcmail.addEventListener('menu-open', 'open_listmenu', rcmail_ui);
- rcmail.addEventListener('menu-save', 'save_listmenu', rcmail_ui);
+ rcmail.addEventListener('menu-open', 'menu_open', rcmail_ui);
+ rcmail.addEventListener('menu-save', 'menu_save', rcmail_ui);
rcmail.addEventListener('aftersend-attachment', 'uploadmenu', rcmail_ui);
rcmail.addEventListener('aftertoggle-editor', 'resize_compose_body_ev', rcmail_ui);
rcmail.gui_object('message_dragmenu', 'dragmessagemenu');
@@ -817,6 +847,11 @@ function rcube_init_mail_ui()
if (rcmail.env.action == 'compose')
rcmail_ui.init_compose_form();
+ else if (rcmail.env.action == 'show' || rcmail.env.action == 'preview')
+ // add menu link for each attachment
+ $('#attachment-list > li[id^="attach"]').each(function() {
+ $(this).append($('<a class="drop">').click(function() { rcmail_ui.show_attachmentmenu(this); }));
+ });
}
else if (rcmail.env.task == 'addressbook') {
rcmail.addEventListener('afterupload-photo', function(){ rcmail_ui.show_popup('uploadform', false); });
diff --git a/skins/classic/mail.css b/skins/classic/mail.css
index 8be35aaa6..4d42d98ff 100644
--- a/skins/classic/mail.css
+++ b/skins/classic/mail.css
@@ -173,13 +173,15 @@
}
#messagemenu li a.active:hover,
+#attachmentmenu li a.active:hover,
#markmessagemenu li a.active:hover
{
color: #fff;
background-color: #c00;
}
-#messagemenu li a
+#messagemenu li a,
+#attachmentmenu li a
{
background: url(images/messageactions.png) no-repeat 7px 0;
background-position: 7px 20px;
@@ -190,7 +192,8 @@
background-position: 7px 1px;
}
-#messagemenu li a.downloadlink
+#messagemenu li a.downloadlink,
+#attachmentmenu li a.downloadlink
{
background-position: 7px -17px;
}
@@ -200,7 +203,8 @@
background-position: 7px -35px;
}
-#messagemenu li a.openlink
+#messagemenu li a.openlink,
+#attachmentmenu li a.openlink
{
background-position: 7px -53px;
}
@@ -1135,6 +1139,16 @@ table.headers-table tr td.header span
text-decoration: underline;
}
+#attachment-list li a.drop {
+ background: url(images/icons/down_small.gif) no-repeat center 6px;
+ width: 12px;
+ height: 7px;
+ cursor: pointer;
+ padding: 5px 0 0;
+ margin-left: 3px;
+ display: inline-block;
+}
+
#messagebody
{
position:relative;
diff --git a/skins/classic/templates/message.html b/skins/classic/templates/message.html
index d1594ea28..73dfcb976 100644
--- a/skins/classic/templates/message.html
+++ b/skins/classic/templates/message.html
@@ -65,5 +65,13 @@
</script>
<roundcube:endif />
+<div id="attachmentmenu" class="popupmenu">
+ <ul class="toolbarmenu">
+ <li><roundcube:button command="open-attachment" id="attachmenuopen" type="link" label="open" class="openlink" classAct="openlink active" innerclass="openlink" /></li>
+ <li><roundcube:button command="download-attachment" id="attachmenudownload" type="link" label="download" class="downloadlink" classAct="downloadlink active" innerclass="downloadlink" /></li>
+ <roundcube:container name="attachmentmenu" id="attachmentmenu" />
+ </ul>
+</div>
+
</body>
</html>
diff --git a/skins/classic/templates/messagepreview.html b/skins/classic/templates/messagepreview.html
index 78b2306f6..935238edf 100644
--- a/skins/classic/templates/messagepreview.html
+++ b/skins/classic/templates/messagepreview.html
@@ -3,8 +3,10 @@
<head>
<title><roundcube:object name="pagetitle" /></title>
<roundcube:include file="/includes/links.html" />
+<script type="text/javascript" src="/splitter.js"></script>
+<script type="text/javascript" src="/functions.js"></script>
</head>
-<body class="iframe">
+<body class="iframe" onload="rcube_init_mail_ui()">
<div class="messageheaderbox">
<roundcube:button command="extwin" image="/images/icons/extwin.png" width="15" height="15" title="openinextwin" id="openextwinlink" />
@@ -16,5 +18,13 @@
<roundcube:object name="messageObjects" id="message-objects" />
<roundcube:object name="messageBody" id="messagebody" />
+<div id="attachmentmenu" class="popupmenu">
+ <ul class="toolbarmenu">
+ <li><roundcube:button command="open-attachment" id="attachmenuopen" type="link" label="open" class="openlink" classAct="openlink active" innerclass="openlink" /></li>
+ <li><roundcube:button command="download-attachment" id="attachmenudownload" type="link" label="download" class="downloadlink" classAct="downloadlink active" innerclass="downloadlink" /></li>
+ <roundcube:container name="attachmentmenu" id="attachmentmenu" />
+ </ul>
+</div>
+
</body>
</html>
diff --git a/skins/larry/images/buttons.gif b/skins/larry/images/buttons.gif
index d8a33d6b2..8a4a78ee4 100644
--- a/skins/larry/images/buttons.gif
+++ b/skins/larry/images/buttons.gif
Binary files differ
diff --git a/skins/larry/images/buttons.png b/skins/larry/images/buttons.png
index 4438d9cbc..0ec061a78 100644
--- a/skins/larry/images/buttons.png
+++ b/skins/larry/images/buttons.png
Binary files differ
diff --git a/skins/larry/mail.css b/skins/larry/mail.css
index c99370830..e6529d118 100644
--- a/skins/larry/mail.css
+++ b/skins/larry/mail.css
@@ -868,7 +868,7 @@ div.more-headers {
}
div.hide-headers {
- background-position: center -1589px;
+ background-position: center -1600px;
}
#all-headers {
diff --git a/skins/larry/styles.css b/skins/larry/styles.css
index 044a09e05..1e3e6f7d5 100644
--- a/skins/larry/styles.css
+++ b/skins/larry/styles.css
@@ -2219,7 +2219,7 @@ ul.toolbarmenu li span.conversation {
display: block;
color: #333;
font-weight: bold;
- padding: 8px 4px 3px 30px;
+ padding: 8px 15px 3px 30px;
text-shadow: 0px 1px 1px #fff;
text-decoration: none;
white-space: nowrap;
@@ -2227,6 +2227,17 @@ ul.toolbarmenu li span.conversation {
text-overflow: ellipsis;
}
+.attachmentslist li a.drop {
+ background: url(images/buttons.png) no-repeat scroll center -1570px;
+ width: 14px;
+ height: 26px;
+ cursor: pointer;
+ position: absolute;
+ right: 0;
+ top: 0;
+ padding: 0;
+}
+
#compose-attachments ul li {
padding-right: 28px;
}
diff --git a/skins/larry/templates/message.html b/skins/larry/templates/message.html
index b4ceb6a6c..36e0efa0a 100644
--- a/skins/larry/templates/message.html
+++ b/skins/larry/templates/message.html
@@ -73,6 +73,14 @@
</div><!-- end mainscreen -->
+<div id="attachmentmenu" class="popupmenu dropdown">
+ <ul class="toolbarmenu">
+ <li><roundcube:button command="open-attachment" id="attachmenuopen" type="link" label="open" class="icon" classAct="icon active" innerclass="icon extwin" /></li>
+ <li><roundcube:button command="download-attachment" id="attachmenudownload" type="link" label="download" class="icon" classAct="icon active" innerclass="icon download" /></li>
+ <roundcube:container name="attachmentmenu" id="attachmentmenu" />
+ </ul>
+</div>
+
<roundcube:include file="/includes/footer.html" />
</body>
diff --git a/skins/larry/templates/messagepreview.html b/skins/larry/templates/messagepreview.html
index aef282ac9..dbfe2dc7b 100644
--- a/skins/larry/templates/messagepreview.html
+++ b/skins/larry/templates/messagepreview.html
@@ -51,6 +51,14 @@
</div>
</div>
+<div id="attachmentmenu" class="popupmenu dropdown">
+ <ul class="toolbarmenu">
+ <li><roundcube:button command="open-attachment" id="attachmenuopen" type="link" label="open" class="icon" classAct="icon active" innerclass="icon extwin" /></li>
+ <li><roundcube:button command="download-attachment" id="attachmenudownload" type="link" label="download" class="icon" classAct="icon active" innerclass="icon download" /></li>
+ <roundcube:container name="attachmentmenu" id="attachmentmenu" />
+ </ul>
+</div>
+
<roundcube:include file="/includes/footer.html" />
</body>
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index d2638bbca..6b2a5c7d0 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -17,6 +17,7 @@ function rcube_mail_ui()
var popupconfig = {
forwardmenu: { editable:1 },
searchmenu: { editable:1, callback:searchmenu },
+ attachmentmenu: { },
listoptions: { editable:1 },
dragmessagemenu: { sticky:1 },
groupmenu: { above:1 },
@@ -81,8 +82,8 @@ function rcube_mail_ui()
/*** mail task ***/
if (rcmail.env.task == 'mail') {
- rcmail.addEventListener('menu-open', show_listoptions);
- rcmail.addEventListener('menu-save', save_listoptions);
+ rcmail.addEventListener('menu-open', menu_open);
+ rcmail.addEventListener('menu-save', menu_save);
rcmail.addEventListener('responseafterlist', function(e){ switch_view_mode(rcmail.env.threading ? 'thread' : 'list') });
var dragmenu = $('#dragmessagemenu');
@@ -95,6 +96,11 @@ function rcube_mail_ui()
rcmail.addEventListener('aftershow-headers', function() { layout_messageview(); });
rcmail.addEventListener('afterhide-headers', function() { layout_messageview(); });
$('#previewheaderstoggle').click(function(e){ toggle_preview_headers(this); return false });
+
+ // add menu link for each attachment
+ $('#attachment-list > li').each(function() {
+ $(this).append($('<a class="drop">').click(function() { attachmentmenu(this); }));
+ });
}
else if (rcmail.env.action == 'compose') {
rcmail.addEventListener('aftertoggle-editor', function(){ window.setTimeout(function(){ layout_composeview() }, 200); });
@@ -436,7 +442,7 @@ function rcube_mail_ui()
{
var obj = popups[popup],
config = popupconfig[popup],
- ref = $('#'+popup+'link'),
+ ref = $(config.link ? config.link : '#'+popup+'link'),
above = config.above;
if (!obj) {
@@ -452,7 +458,7 @@ function rcube_mail_ui()
else if (config.toggle && show && obj.is(':visible'))
show = false;
- if (show && ref) {
+ if (show && ref.length) {
var parent = ref.parent(),
win = $(window),
pos;
@@ -575,6 +581,19 @@ function rcube_mail_ui()
/**** popup callbacks ****/
+ function menu_open(p)
+ {
+ if (p && p.props && p.props.menu == 'attachmentmenu')
+ show_popupmenu('attachmentmenu');
+ else
+ show_listoptions();
+ }
+
+ function menu_save(prop)
+ {
+ save_listoptions();
+ }
+
function searchmenu(show)
{
if (show && rcmail.env.search_mods) {
@@ -605,6 +624,21 @@ function rcube_mail_ui()
}
}
+ function attachmentmenu(elem)
+ {
+ var id = elem.parentNode.id.replace(/^attach/, '');
+
+ $('#attachmenuopen').unbind('click').attr('onclick', '').click(function(e) {
+ return rcmail.command('open-attachment', id, this);
+ });
+
+ $('#attachmenudownload').unbind('click').attr('onclick', '').click(function() {
+ rcmail.command('download-attachment', id, this);
+ });
+
+ popupconfig.attachmentmenu.link = elem;
+ rcmail.command('menu-open', {menu: 'attachmentmenu', id: id});
+ }
function spellmenu(show)
{