From 0e530bd9203e79218e9aad631e8495794a72a042 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 05 Jan 2012 07:12:18 -0500
Subject: [PATCH] Show additional popup dialog on error messages
---
skins/larry/styles.css | 43 +++++++++++++++++++++
program/js/app.js | 2 +
skins/larry/ui.js | 36 ++++++++++++++++++
3 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/program/js/app.js b/program/js/app.js
index 27af1ff..7fe300b 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -5423,6 +5423,8 @@
obj.click(function() { return ref.hide_message(obj); });
}
+ this.triggerEvent('message', { message:msg, type:type, timeout:timeout, object:obj });
+
if (timeout > 0)
window.setTimeout(function() { ref.hide_message(id, type == 'loading'); }, timeout);
return id;
diff --git a/skins/larry/styles.css b/skins/larry/styles.css
index 693397f..8527dea 100644
--- a/skins/larry/styles.css
+++ b/skins/larry/styles.css
@@ -435,6 +435,49 @@
text-overflow: ellipsis;
}
+.ui-dialog.error .ui-dialog-title,
+.ui-dialog.warning .ui-dialog-title,
+.ui-dialog.confirmation .ui-dialog-title {
+ padding-left: 25px;
+ background: url(images/messages.png) 0 5px no-repeat;
+ text-shadow: 0 1px 1px #fff;
+}
+
+.ui-dialog.warning .ui-dialog-title {
+ color: #960;
+ background-position: 0 -90px;
+}
+
+.ui-dialog.error .ui-dialog-title {
+ color: #cf2734;
+ background-position: 0 -60px;
+}
+
+.ui-dialog.confirmation .ui-dialog-title {
+ color: #093;
+ background-position: 0 -30px;
+}
+
+.ui-dialog.popupmessage .ui-dialog-titlebar {
+ padding: 8px 1em 4px 1em;
+ background: #e3e3e3;
+ background: -moz-linear-gradient(top, #e3e3e3 0%, #cfcfcf 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e3e3e3), color-stop(100%,#cfcfcf));
+ background: -o-linear-gradient(top, #e3e3e3 0%, #cfcfcf 100%);
+ background: -ms-linear-gradient(top, #e3e3e3 0%, #cfcfcf 100%);
+ background: linear-gradient(top, #e3e3e3 0%, #cfcfcf 100%);
+}
+
+.ui-dialog.popupmessage .ui-widget-content {
+ font-size: 12px;
+ background: #eee;
+ background: -moz-linear-gradient(top, #eee 0%, #dcdcdc 100%);
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eee), color-stop(100%,#dcdcdc));
+ background: -o-linear-gradient(top, #eee 0%, #dcdcdc 100%);
+ background: -ms-linear-gradient(top, #eee 0%, #dcdcdc 100%);
+ background: linear-gradient(top, #eee 0%, #dcdcdc 100%);
+}
+
/*** basic page layout ***/
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index c43198a..ee51500 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -58,6 +58,8 @@
*/
function init()
{
+ rcmail.addEventListener('message', message_displayed);
+
if (rcmail.env.task == 'mail') {
rcmail.addEventListener('menu-open', show_listoptions);
rcmail.addEventListener('menu-save', save_listoptions);
@@ -198,6 +200,39 @@
}
/**
+ * Triggered when a new user message is displayed
+ */
+ function message_displayed(p)
+ {
+ // show a popup dialog on errors
+ if (p.type == 'error') {
+ if (!me.messagedialog) {
+ me.messagedialog = $('<div>').addClass('popupdialog');
+ }
+
+ var pos = $(p.object).offset();
+ me.messagedialog.dialog('close');
+ me.messagedialog.html(p.message)
+ .dialog({
+ resizable: false,
+ closeOnEscape: true,
+ dialogClass: 'popupmessage ' + p.type,
+ title: null,
+ close: function() {
+ me.messagedialog.dialog('destroy').hide();
+ },
+ position: ['center', pos.top - 160],
+ hide: { effect:'drop', direction:'down' },
+ width: 420,
+ minHeight: 90
+ }).show();
+
+ window.setTimeout(function(){ me.messagedialog.dialog('close'); }, p.timeout / 2);
+ }
+ }
+
+
+ /**
* Adjust UI objects of the mail view screen
*/
function layout_messageview()
@@ -214,6 +249,7 @@
function render_mailboxlist(splitter)
{
+ // TODO: implement smart shortening of long folder names
}
--
Gitblit v1.9.1