From 1dfbe73b73213b846be4c979ad3b06ce3a533b46 Mon Sep 17 00:00:00 2001 From: zzz Date: Tue, 29 Apr 2014 19:50:28 +0000 Subject: [PATCH] * SusiMail: - Add print css - Add some divs - Hide header and footer in mobile css - Fix 'from' address in compose - Boolean config parse cleanup - Config textarea row count --- apps/susimail/build.xml | 4 + apps/susimail/src/css/print.css | 27 ++++++ .../src/src/i2p/susi/webmail/WebMail.java | 83 +++++++++++-------- .../resources/themes/susimail/dark/mobile.css | 4 + .../themes/susimail/dark/susimail.css | 5 ++ .../themes/susimail/light/mobile.css | 4 + .../themes/susimail/light/susimail.css | 4 +- 7 files changed, 94 insertions(+), 37 deletions(-) create mode 100644 apps/susimail/src/css/print.css diff --git a/apps/susimail/build.xml b/apps/susimail/build.xml index bb80ea274..4c0e49e6f 100644 --- a/apps/susimail/build.xml +++ b/apps/susimail/build.xml @@ -66,6 +66,10 @@ + + + + diff --git a/apps/susimail/src/css/print.css b/apps/susimail/src/css/print.css new file mode 100644 index 000000000..6f56a1fd9 --- /dev/null +++ b/apps/susimail/src/css/print.css @@ -0,0 +1,27 @@ +.header, .footer, .topbuttons, .bottombuttons { + display: none; +} + +p.error, p.info { + display: none; +} + +a.sort, img.sort { + display: none; +} + +input.optbox { + display: none; +} + +div.page, table { + width: 100%; + margin: 0; + float: none; +} + +textarea, input[type=text] { + border-style: none; + border-color: Transparent; + overflow: auto; +} diff --git a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java index 1539a5cde..399b6f004 100644 --- a/apps/susimail/src/src/i2p/susi/webmail/WebMail.java +++ b/apps/susimail/src/src/i2p/susi/webmail/WebMail.java @@ -506,17 +506,17 @@ public class WebMail extends HttpServlet StringBuilder buf = new StringBuilder(128); buf.append(label).append("  "); if (name.equals(currentName) && currentOrder == Folder.SortOrder.UP) { - buf.append("\"^\"\n"); + buf.append("\"^\"\n"); } else { - buf.append(""); - buf.append("\"^\""); + buf.append(""); + buf.append("\"^\""); buf.append("\n"); } if (name.equals(currentName) && currentOrder == Folder.SortOrder.DOWN) { - buf.append("\"v\""); + buf.append("\"v\""); } else { - buf.append(""); - buf.append("\"v\""); + buf.append(""); + buf.append("\"v\""); buf.append(""); } return buf.toString(); @@ -711,8 +711,8 @@ public class WebMail extends HttpServlet String host = request.getParameter( HOST ); String pop3Port = request.getParameter( POP3 ); String smtpPort = request.getParameter( SMTP ); - String fixedPorts = Config.getProperty( CONFIG_PORTS_FIXED, "true" ); - if( !fixedPorts.equalsIgnoreCase("false")) { + boolean fixedPorts = Boolean.parseBoolean(Config.getProperty( CONFIG_PORTS_FIXED, "true" )); + if (fixedPorts) { host = Config.getProperty( CONFIG_HOST, DEFAULT_HOST ); pop3Port = Config.getProperty( CONFIG_PORTS_POP3, "" + DEFAULT_POP3PORT ); smtpPort = Config.getProperty( CONFIG_PORTS_SMTP, "" + DEFAULT_SMTPPORT ); @@ -1702,21 +1702,23 @@ public class WebMail extends HttpServlet out.println( "\n" + "\n" ); } + if(sessionObject.state != STATE_AUTH) + out.println(""); if (sessionObject.state == STATE_NEW) { // TODO cancel if to and body are empty out.println( - "" ); } out.println( "\n\n" + - "

\"Susimail\"

\n" + + "
\"Susimail\"
\n" + "
" ); if( sessionObject.error != null && sessionObject.error.length() > 0 ) { @@ -1744,7 +1746,7 @@ public class WebMail extends HttpServlet showConfig(out, sessionObject); //out.println( "

susimail v0." + version +" " + ( RELEASE ? "release" : "development" ) + " © 2004-2005 susi

\n"); - out.println( "

susimail © 2004-2005 susi

\n"); + out.println( "

susimail © 2004-2005 susi

\n"); out.flush(); } } @@ -1831,9 +1833,9 @@ public class WebMail extends HttpServlet String subject = request.getParameter( NEW_SUBJECT, _("no subject") ); String text = request.getParameter( NEW_TEXT, "" ); - String prop = Config.getProperty( CONFIG_SENDER_FIXED, "true" ); - String domain = Config.getProperty( CONFIG_SENDER_DOMAIN, "mail.i2p" ); - if( !prop.equalsIgnoreCase("false")) { + boolean fixed = Boolean.parseBoolean(Config.getProperty( CONFIG_SENDER_FIXED, "true" )); + if (fixed) { + String domain = Config.getProperty( CONFIG_SENDER_DOMAIN, "mail.i2p" ); from = "<" + sessionObject.user + "@" + domain + ">"; } ArrayList toList = new ArrayList(); @@ -1979,16 +1981,18 @@ public class WebMail extends HttpServlet */ private static void showCompose( PrintWriter out, SessionObject sessionObject, RequestWrapper request ) { + out.println("
"); out.println( button( SEND, _("Send") ) + spacer + button( CANCEL, _("Cancel") )); + out.println("
"); //if (Config.hasConfigFile()) // out.println(button( RELOAD, _("Reload Config") ) + spacer); //out.println(button( LOGOUT, _("Logout") ) ); String from = request.getParameter( NEW_FROM ); - String fixed = Config.getProperty( CONFIG_SENDER_FIXED, "true" ); + boolean fixed = Boolean.parseBoolean(Config.getProperty( CONFIG_SENDER_FIXED, "true" )); - if( from == null || !fixed.equalsIgnoreCase("false")) { + if (from == null || !fixed) { String user = sessionObject.user; String name = Config.getProperty(CONFIG_SENDER_NAME); if (name != null) { @@ -2001,10 +2005,12 @@ public class WebMail extends HttpServlet from = ""; } if (user.contains("@")) { - String domain = Config.getProperty( CONFIG_SENDER_DOMAIN, "mail.i2p" ); - from += '<' + user + '@' + domain + '>'; - } else { from += '<' + user + '>'; + } else { + String domain = Config.getProperty( CONFIG_SENDER_DOMAIN, "mail.i2p" ); + if (from.length() == 0) + from = user + ' '; + from += '<' + user + '@' + domain + '>'; } } @@ -2020,17 +2026,17 @@ public class WebMail extends HttpServlet out.println( "\n" + "\n" + - "\n" + + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + - "" + + "\n" + + "" + // TODO disable/hide in JS if no file selected - ""); + ""); if( sessionObject.attachments != null && !sessionObject.attachments.isEmpty() ) { boolean wroteHeader = false; @@ -2044,7 +2050,7 @@ public class WebMail extends HttpServlet out.println(""); } // TODO disable in JS if none selected - out.println(""); } @@ -2057,8 +2063,7 @@ public class WebMail extends HttpServlet */ private static void showLogin( PrintWriter out ) { - String fixedPorts = Config.getProperty( CONFIG_PORTS_FIXED, "true" ); - boolean fixed = !fixedPorts.equalsIgnoreCase("false"); + boolean fixed = Boolean.parseBoolean(Config.getProperty( CONFIG_PORTS_FIXED, "true" )); String host = Config.getProperty( CONFIG_HOST, DEFAULT_HOST ); String pop3 = Config.getProperty( CONFIG_PORTS_POP3, "" + DEFAULT_POP3PORT ); String smtp = Config.getProperty( CONFIG_PORTS_SMTP, "" + DEFAULT_SMTPPORT ); @@ -2098,6 +2103,7 @@ public class WebMail extends HttpServlet */ private static void showFolder( PrintWriter out, SessionObject sessionObject, RequestWrapper request ) { + out.println("
"); out.println( button( NEW, _("New") ) + spacer); // In theory, these are valid and will apply to the first checked message, // but that's not obvious and did it work? @@ -2109,9 +2115,10 @@ public class WebMail extends HttpServlet //if (Config.hasConfigFile()) // out.println(button( RELOAD, _("Reload Config") ) + spacer); out.println(button( LOGOUT, _("Logout") )); - if (sessionObject.folder.getPages() > 1) showPageButtons(out, sessionObject.folder); + out.println("
"); + String curSort = sessionObject.folder.getCurrentSortBy(); Folder.SortOrder curOrder = sessionObject.folder.getCurrentSortingDirection(); @@ -2177,14 +2184,14 @@ public class WebMail extends HttpServlet if (i == 0) out.println("\n

" + _("From") + ":
" + _("From") + ":
" + _("To") + ":
" + _("Cc") + ":
" + _("Bcc") + ":
" + _("Bcc to self") + ":
" + _("Subject") + ":
" + - "

" + _("Add Attachment") + ":

" + _("Add Attachment") + ":
 " + button(NEW_UPLOAD, _("Add another attachment")) + "
 " + button(NEW_UPLOAD, _("Add another attachment")) + "
 " + attachment.getFileName() + "
 " + + out.println("
 " + button( DELETE_ATTACHMENT, _("Delete selected attachments") ) + "
" + _("No messages") + "
"); if (i > 0) { - out.println( "
"); + out.println( "
"); if (sessionObject.folder.getPages() > 1 && i > 30) { // show the buttons again if page is big - out.println(""); + out.println(""); showPageButtons(out, sessionObject.folder); out.println(""); } - out.println(""); + out.println(""); if( sessionObject.reallyDelete ) { // TODO ngettext out.println("

" + _("Really delete the marked messages?") + @@ -2209,7 +2216,7 @@ public class WebMail extends HttpServlet // button( SETPAGESIZE, _("Set") ) ); out.print("
"); out.print(button(CONFIGURE, _("Settings"))); - out.println(""); + out.println(""); } out.println( ""); } @@ -2251,6 +2258,7 @@ public class WebMail extends HttpServlet out.println( quoteHTML( new String(body.content, body.offset, body.length ) ) ); out.println( "-->" ); } + out.println("

"); out.println( button( NEW, _("New") ) + spacer + button( REPLY, _("Reply") ) + button( REPLYALL, _("Reply All") ) + @@ -2260,6 +2268,7 @@ public class WebMail extends HttpServlet ( sessionObject.folder.isFirstElement( sessionObject.showUIDL ) ? button2( PREV, _("Previous") ) : button( PREV, _("Previous") ) ) + spacer + button( LIST, _("Back to Folder") ) + spacer + ( sessionObject.folder.isLastElement( sessionObject.showUIDL ) ? button2( NEXT, _("Next") ) : button( NEXT, _("Next") ) )); + out.println("
"); //if (Config.hasConfigFile()) // out.println(button( RELOAD, _("Reload Config") ) + spacer); //out.println(button( LOGOUT, _("Logout") ) ); @@ -2298,24 +2307,28 @@ public class WebMail extends HttpServlet sz = sessionObject.folder.getPageSize(); else sz = Config.getProperty(Folder.PAGESIZE, Folder.DEFAULT_PAGESIZE); + out.println("
"); out.println( _("Folder Page Size") + ": " + " " + button( SETPAGESIZE, _("Set") ) ); out.println("

"); + out.println("

"); out.print(_("Advanced Configuration")); - out.print(":

"); - out.println("
"); + out.println("
"); + out.println("
"); out.println(button(SAVE, _("Save Configuration"))); out.println(button(CANCEL, _("Cancel"))); + out.println("
"); } /** translate */ diff --git a/installer/resources/themes/susimail/dark/mobile.css b/installer/resources/themes/susimail/dark/mobile.css index 2bfa5c548..e30f878be 100644 --- a/installer/resources/themes/susimail/dark/mobile.css +++ b/installer/resources/themes/susimail/dark/mobile.css @@ -11,3 +11,7 @@ #mailbox .optbox { float: left; } + +div.header, div.footer { + display: none; +} diff --git a/installer/resources/themes/susimail/dark/susimail.css b/installer/resources/themes/susimail/dark/susimail.css index 1f7686b83..bd239b5c3 100644 --- a/installer/resources/themes/susimail/dark/susimail.css +++ b/installer/resources/themes/susimail/dark/susimail.css @@ -88,6 +88,11 @@ p.mailbody { text-align: left; } +.iframed .header { + display: none; +} + + .mailbody { display: block !important; } diff --git a/installer/resources/themes/susimail/light/mobile.css b/installer/resources/themes/susimail/light/mobile.css index 2bfa5c548..e30f878be 100644 --- a/installer/resources/themes/susimail/light/mobile.css +++ b/installer/resources/themes/susimail/light/mobile.css @@ -11,3 +11,7 @@ #mailbox .optbox { float: left; } + +div.header, div.footer { + display: none; +} diff --git a/installer/resources/themes/susimail/light/susimail.css b/installer/resources/themes/susimail/light/susimail.css index 48f5ccd91..d602efd93 100644 --- a/installer/resources/themes/susimail/light/susimail.css +++ b/installer/resources/themes/susimail/light/susimail.css @@ -56,7 +56,7 @@ p.footer { line-height:10pt; } -.iframed #footer { +.iframed .footer { display: none; } @@ -67,7 +67,7 @@ p.mailbody { text-align: left; } -.iframed p img { +.iframed .header { display: none; }