james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norman Maurer <norman.mau...@googlemail.com>
Subject Re: svn commit: r882863 - in /james/hupa/trunk: client/src/main/java/org/apache/hupa/client/ client/src/main/java/org/apache/hupa/client/mvp/ client/war/ client/war/WEB-INF/ server/src/main/java/org/apache/hupa/server/handler/ server/src/test/java/or
Date Sat, 21 Nov 2009 10:03:24 GMT
Very good work, the editor now looks awesome :)

Bye,
Norman

2009/11/21  <manolo@apache.org>:
> Author: manolo
> Date: Sat Nov 21 09:10:09 2009
> New Revision: 882863
>
> URL: http://svn.apache.org/viewvc?rev=882863&view=rev
> Log:
> Basic implementation of the 'wysiwyg' email editor.
> Changes in sendmail-handler to send both html and txt version of the message.
>
> Added:
>    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
> Modified:
>    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java
>    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.java
>    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.properties
>    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties
>    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
>    james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
>    james/hupa/trunk/client/war/   (props changed)
>    james/hupa/trunk/client/war/Hupa.css
>    james/hupa/trunk/client/war/WEB-INF/   (props changed)
>    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
>    james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java
>    james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java
>    james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/editor/Editor.java
>
> Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java (original)
> +++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/Hupa.java Sat Nov 21
09:10:09 2009
> @@ -23,16 +23,29 @@
>
>  import org.apache.hupa.client.gin.HupaGinjector;
>  import org.apache.hupa.client.mvp.AppPresenter;
> +import org.apache.hupa.widgets.editor.Editor;
> +import org.apache.hupa.widgets.editor.Toolbar;
>
>  import com.google.gwt.core.client.EntryPoint;
>  import com.google.gwt.core.client.GWT;
>  import com.google.gwt.user.client.DOM;
> +import com.google.gwt.user.client.Window;
> +import com.google.gwt.user.client.ui.RichTextArea;
>  import com.google.gwt.user.client.ui.RootPanel;
> +import com.google.gwt.user.client.ui.VerticalPanel;
>
>  public class Hupa implements EntryPoint{
>     private final HupaGinjector injector = GWT.create(HupaGinjector.class);
>
>     public void onModuleLoad() {
> +        if (null != Window.Location.getParameter("test"))
> +            onModuleLoadMine();
> +        else
> +            onModuleLoadOrg();
> +
> +    }
> +
> +    public void onModuleLoadOrg() {
>         // remove the loading message from the browser
>         com.google.gwt.user.client.Element loading = DOM.getElementById("loading");
>
> @@ -48,4 +61,12 @@
>         placeManager.fireCurrentPlace();
>     }
>
> +    public void onModuleLoadMine() {
> +
> +        DOM.setInnerHTML(RootPanel.get("loading").getElement(), "");
> +
> +        RootPanel.get().add(new Editor());
> +
> +    }
> +
>  }
>
> Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.java
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.java?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.java (original)
> +++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.java Sat
Nov 21 09:10:09 2009
> @@ -19,13 +19,14 @@
>
>  package org.apache.hupa.client;
>
> -import org.apache.hupa.widgets.PagingOptionsConstants;
> -
>  import gwtupload.client.IUploader.UploaderConstants;
>
> +import org.apache.hupa.widgets.PagingOptionsConstants;
> +import org.apache.hupa.widgets.editor.ToolbarConstants;
> +
>  import com.google.gwt.i18n.client.Constants;
>
> -public interface HupaConstants extends Constants, UploaderConstants, PagingOptionsConstants
{
> +public interface HupaConstants extends Constants, UploaderConstants, PagingOptionsConstants,
ToolbarConstants {
>
>     public String usernameLabel();
>
>
> Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.properties
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.properties?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.properties
(original)
> +++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants.properties
Sat Nov 21 09:10:09 2009
> @@ -19,6 +19,47 @@
>  #uploaderServerUnavailable=Unable to contact with the server:
>  #uploaderSend=Send
>
> +#
> +# These English constants are already defined in editor widget.
> +# They are here as a reference to generate constants for other languages
> +# using this file as template
> +#
> +#editor_bold = Toggle Bold
> +#editor_createLink = Create Link
> +#editor_hr = Insert Horizontal Rule
> +#editor_indent = Indent Right
> +#editor_insertImage = Insert Image
> +#editor_italic = Toggle Italic
> +#editor_justifyCenter = Center
> +#editor_justifyLeft = Left Justify
> +#editor_justifyRight = Right Justify
> +#editor_ol = Insert Ordered List
> +#editor_outdent = Indent Left
> +#editor_removeFormat = Remove Formatting
> +#editor_removeLink = Remove Link
> +#editor_strikeThrough = Toggle Strikethrough
> +#editor_subscript = Toggle Subscript
> +#editor_superscript = Toggle Superscript
> +#editor_ul = Insert Unordered List
> +#editor_underline = Toggle Underline
> +#editor_color = Color
> +#editor_black = Black
> +#editor_white = White
> +#editor_red = Red
> +#editor_green = Green
> +#editor_yellow = Yellow
> +#editor_blue = Blue
> +#editor_font = Font
> +#editor_normal = Normal
> +#editor_size = Size
> +#editor_xxsmall = XX-Small
> +#editor_xsmall = X-Small
> +#editor_small = Small
> +#editor_medium = Medium
> +#editor_large = Large
> +#editor_xlarge = X-Large
> +#editor_xxlarge = XX-Large
> +
>  usernameLabel=Username:
>  passwordLabel=Password:
>  saveLoginLabel=Save login data
>
> Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties
(original)
> +++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/HupaConstants_es.properties
Sat Nov 21 09:10:09 2009
> @@ -20,6 +20,43 @@
>  #uploaderSend=Enviar
>  #
>
> +# Editor
> +editor_bold = Negrilla
> +editor_createLink = Crear enlace
> +editor_hr = Insertar linea horizontal
> +editor_indent = Identar a la Derecha
> +editor_insertImage = Insertar imagen
> +editor_italic = Cursiva
> +editor_justifyCenter = Centrar
> +editor_justifyLeft = Justificar a la Izquierda
> +editor_justifyRight = Justificar a la Derecha
> +editor_ol = Lista ordenada
> +editor_outdent = Identar a la Izquierda
> +editor_removeFormat = Eliminar formato
> +editor_removeLink = Eliminar enlace
> +editor_strikeThrough = Tachado
> +editor_subscript = Subíndice
> +editor_superscript = Superíndice
> +editor_ul = Lista no ordenada
> +editor_underline = Subrayado
> +editor_color = Color
> +editor_black = Negro
> +editor_white = Blanco
> +editor_red = Rojo
> +editor_green = Verde
> +editor_yellow = Amarillo
> +editor_blue = Azul
> +editor_font = Fuente
> +editor_normal = Normal
> +editor_size = Tamaño
> +editor_xxsmall = Enana
> +editor_xsmall = Muy pequeña
> +editor_small = Pequeña
> +editor_medium = Mediana
> +editor_large = Grande
> +editor_xlarge = Muy grande
> +editor_xxlarge = Enorme
> +
>  usernameLabel=Nombre de Usuario:
>  passwordLabel=Contraseña:
>  saveLoginLabel=Salvar datos de entrada
>
> Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
(original)
> +++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendPresenter.java
Sat Nov 21 09:10:09 2009
> @@ -52,6 +52,7 @@
>  import com.google.gwt.event.dom.client.ClickHandler;
>  import com.google.gwt.event.dom.client.HasClickHandlers;
>  import com.google.gwt.user.client.Window;
> +import com.google.gwt.user.client.ui.HasHTML;
>  import com.google.gwt.user.client.ui.HasText;
>  import com.google.inject.Inject;
>
> @@ -165,7 +166,7 @@
>         public HasText getCcText();
>         public HasText getBccText();
>         public HasText getSubjectText();
> -        public HasText getMessageText();
> +        public HasHTML getMessageHTML();
>         public HasClickHandlers getSendClick();
>         public HasEnable getSendEnable();
>         public IUploader getUploader();
> @@ -231,7 +232,7 @@
>                     message.setCc(cc);
>
>                     message.setSubject(display.getSubjectText().getText());
> -                    message.setText(display.getMessageText().getText());
> +                    message.setText(display.getMessageHTML().getHTML());
>
>                     message.setMessageAttachments(attachments);
>
> @@ -317,7 +318,7 @@
>         // cancel the current upload when unbinding
>         display.getUploader().cancel();
>     }
> -
> +
>     /**
>      * Bind the given values to this presenter
>      *
> @@ -338,21 +339,14 @@
>         display.getCcText().setText("");
>         display.getBccText().setText("");
>         display.getSubjectText().setText("");
> -        display.getMessageText().setText("");
> +        display.getMessageHTML().setHTML("");
>
> -        display.getMessageText().setText("");
>         if (type.equals(Type.FORWARD)) {
>             display.getSubjectText().setText("Fwd: " + oldmessage.getSubject());
> -            display.getMessageText().setText("\n\n-------- Original Message -------\n"
);
> +            display.getMessageHTML().setHTML(wrapMessage(oldmessage, oldDetails));
>         } else if (type.equals(Type.REPLY) || type.equals(Type.REPLY_ALL)) {
>             display.getSubjectText().setText("Re: " + oldmessage.getSubject());
> -
> -            String oldMessageText = oldDetails.getText();
> -            StringBuffer messageText = new StringBuffer("\n\n-------- Message
-------\n");
> -            if ( oldMessageText != null) {
> -                messageText.append(oldMessageText);
> -            }
> -            display.getMessageText().setText(messageText.toString());
> +            display.getMessageHTML().setHTML(wrapMessage(oldmessage, oldDetails));
>
>             if (type.equals(Type.REPLY)) {
>                 display.getToText().setText(oldmessage.getFrom());
> @@ -393,4 +387,15 @@
>         // DO Nothing
>     }
>
> +    private String wrapMessage(Message message, MessageDetails details){
> +        String ret;
> +        ret = "<font size=2 style='font-family: arial'>";
> +        ret += "<br><br>On " + message.getReceivedDate() + ", " + message.getFrom()
+". wrote:<br>";
> +        ret += "<blockquote style='border-left: 1px solid rgb(204, 204, 204);
margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;'>";
> +        ret += details.getText();
> +        ret += "</blockquote></font>";
> +        return ret;
> +    }
> +
> +
>  }
>
> Modified: james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
(original)
> +++ james/hupa/trunk/client/src/main/java/org/apache/hupa/client/mvp/MessageSendView.java
Sat Nov 21 09:10:09 2009
> @@ -26,10 +26,11 @@
>
>  import org.apache.hupa.client.HupaConstants;
>  import org.apache.hupa.client.widgets.EnableButton;
> -import org.apache.hupa.widgets.ui.EnableHyperlink;
> -import org.apache.hupa.widgets.ui.Loading;
>  import org.apache.hupa.shared.SConsts;
> +import org.apache.hupa.widgets.editor.Editor;
> +import org.apache.hupa.widgets.ui.EnableHyperlink;
>  import org.apache.hupa.widgets.ui.HasEnable;
> +import org.apache.hupa.widgets.ui.Loading;
>
>  import com.google.gwt.core.client.GWT;
>  import com.google.gwt.event.dom.client.HasClickHandlers;
> @@ -38,10 +39,10 @@
>  import com.google.gwt.user.client.Window;
>  import com.google.gwt.user.client.ui.Composite;
>  import com.google.gwt.user.client.ui.Grid;
> +import com.google.gwt.user.client.ui.HasHTML;
>  import com.google.gwt.user.client.ui.HasText;
>  import com.google.gwt.user.client.ui.HorizontalPanel;
>  import com.google.gwt.user.client.ui.Label;
> -import com.google.gwt.user.client.ui.TextArea;
>  import com.google.gwt.user.client.ui.TextBox;
>  import com.google.gwt.user.client.ui.VerticalPanel;
>  import com.google.gwt.user.client.ui.Widget;
> @@ -62,7 +63,7 @@
>     private TextBox subject = new TextBox();
>     private BaseUploadStatus uploadStatus = new BaseUploadStatus();
>     private MultiUploader uploader = new MultiUploader(uploadStatus);
> -    private TextArea text = new TextArea();
> +    private Editor editor = new Editor();
>     private EnableButton sendButton;
>     private EnableHyperlink backButton;
>     private Loading sendProgress = new Loading();
> @@ -73,7 +74,7 @@
>         backButton = new EnableHyperlink(constants.backButton(),"");
>         final VerticalPanel mPanel = new VerticalPanel();
>         //mPanel.setWidth("100%");
> -        mPanel.setWidth(Window.getClientWidth() -200 +"px");
> +        mPanel.setWidth(Window.getClientWidth() -10 +"px");
>
>         Window.addResizeHandler(new ResizeHandler() {
>
> @@ -155,9 +156,8 @@
>
>         subject.setWidth("100%");
>
> -        text.setWidth("100%");
> -        text.setHeight("400px");
> -        text.setVisibleLines(50);
> +        editor.setWidth("100%");
> +        editor.setHeight("400px");
>
>         uploadStatus.setCancelConfiguration(IUploadStatus.GMAIL_CANCEL_CFG);
>         uploader.setServletPath(GWT.getModuleBaseURL() + SConsts.SERVLET_UPLOAD);
> @@ -177,7 +177,7 @@
>
>         mPanel.add(buttonBar);
>
> -        mPanel.add(text);
> +        mPanel.add(editor);
>         initWidget(mPanel);
>
>     }
> @@ -237,7 +237,7 @@
>      * @see org.apache.hupa.client.mvp.MessageSendPresenter.Display#getMessageText()
>      */
>     public HasText getMessageText() {
> -        return text;
> +        return editor;
>     }
>
>     /*
> @@ -299,4 +299,8 @@
>     public HasClickHandlers getBackButtonClick() {
>         return backButton;
>     }
> +
> +    public HasHTML getMessageHTML() {
> +        return editor;
> +    }
>  }
>
> Propchange: james/hupa/trunk/client/war/
> ------------------------------------------------------------------------------
> --- svn:ignore (added)
> +++ svn:ignore Sat Nov 21 09:10:09 2009
> @@ -0,0 +1,3 @@
> +hupa
> +org.apache.hupa.Shared
> +org.apache.hupa.Widgets
>
> Modified: james/hupa/trunk/client/war/Hupa.css
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/client/war/Hupa.css?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/client/war/Hupa.css (original)
> +++ james/hupa/trunk/client/war/Hupa.css Sat Nov 21 09:10:09 2009
> @@ -120,3 +120,6 @@
>        color:                                              
   red;
>  }
>
> +.hupa-editor {
> +       border: 2px solid #E0ECFF;
> +}
>
> Propchange: james/hupa/trunk/client/war/WEB-INF/
> ------------------------------------------------------------------------------
> --- svn:ignore (added)
> +++ svn:ignore Sat Nov 21 09:10:09 2009
> @@ -0,0 +1 @@
> +lib
>
> Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
(original)
> +++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/AbstractSendMessageHandler.java
Sat Nov 21 09:10:09 2009
> @@ -114,18 +114,21 @@
>
>         SMTPMessage m = action.getMessage();
>         ArrayList<MessageAttachment> attachments = m.getMessageAttachments();
> +
> +        // Create the body
> +        Multipart body = createMultipartAlternative(m.getText());
> +
>         // check if there are any attachments to include
>         if (attachments == null || attachments.isEmpty()) {
> -            message.setText(m.getText());
> +            message.setContent(body);
>         } else {
>             // create the message part
>             MimeBodyPart messageBodyPart = new MimeBodyPart();
>
>             // fill message
> -            messageBodyPart.setText(m.getText());
> +            messageBodyPart.setContent(body);
>
>             Multipart multipart = new MimeMultipart();
> -            multipart.addBodyPart(messageBodyPart);
>
>             multipart = handleAttachments(multipart, attachments);
>
> @@ -137,6 +140,33 @@
>         message.saveChanges();
>         return message;
>     }
> +
> +    protected String htmlToText(String s){
> +        s=s.replaceAll("\n", " ");
> +        s=s.replaceAll("(?si)<br\\s*?/?>", "\n");
> +        s=s.replaceAll("(?si)</div\\s*?>", "\n");
> +        s=s.replaceAll("(\\w)<.*?>(\\w)", "$1 $2");
> +        s=s.replaceAll("<.*?>", "");
> +        s=s.replaceAll("[ \t]+", " ");
> +        return s;
> +    }
> +
> +    protected Multipart createMultipartAlternative(String html) throws MessagingException
{
> +        MimeMultipart mimeMultipart= new MimeMultipart();
> +        mimeMultipart.setSubType("alternative");
> +
> +        MimeBodyPart txtPart= new MimeBodyPart();
> +        txtPart.setContent(htmlToText(html), "text/plain");
> +        mimeMultipart.addBodyPart(txtPart);
> +
> +        MimeBodyPart htmlPart= new MimeBodyPart();
> +        htmlPart.setContent(html, "text/html");
> +        htmlPart.setHeader("Content-Type", "text/html; format=flowed");
> +        mimeMultipart.addBodyPart(htmlPart);
> +
> +        return mimeMultipart;
> +
> +    }
>
>     protected void resetAttachments(A action) throws MessagingException, ActionException
{
>         SMTPMessage m = action.getMessage();
>
> Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java
(original)
> +++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/handler/GetMessageDetailsHandler.java
Sat Nov 21 09:10:09 2009
> @@ -315,9 +315,6 @@
>         if (html == null || html.length()==0)
>             return html;
>
> -        // wrap the entire html document in a classed div
> -        html = "<div class='hupa-email-content'>\n" + html + "\n</div>\n";
> -
>         // Replace in-line images links to use Hupa's download servlet
>         html = replaceAll(html, regex_inlineImg, repl_inlineImg).replaceAll("%%FOLDER%%",folderName).replaceAll("%%UID%%",
String.valueOf(uuid));
>         // Remove head, script and style tags to avoid interferences with Hupa
>
> Added: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java?rev=882863&view=auto
> ==============================================================================
> --- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
(added)
> +++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/AbtractSendMessageHandlerTest.java
Sat Nov 21 09:10:09 2009
> @@ -0,0 +1,53 @@
> +/****************************************************************
> + * Licensed to the Apache Software Foundation (ASF) under one   *
> + * or more contributor license agreements.  See the NOTICE file *
> + * distributed with this work for additional information        *
> + * regarding copyright ownership.  The ASF licenses this file   *
> + * to you under the Apache License, Version 2.0 (the            *
> + * "License"); you may not use this file except in compliance   *
> + * with the License.  You may obtain a copy of the License at   *
> + *                                                      
       *
> + *   http://www.apache.org/licenses/LICENSE-2.0                 *
> + *                                                      
       *
> + * Unless required by applicable law or agreed to in writing,   *
> + * software distributed under the License is distributed on an  *
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
> + * KIND, either express or implied.  See the License for the    *
> + * specific language governing permissions and limitations      *
> + * under the License.                                          
*
> + ****************************************************************/
> +
> +package org.apache.hupa.server.handler;
> +
> +import javax.mail.Message;
> +import javax.mail.MessagingException;
> +import javax.mail.Session;
> +import javax.mail.internet.AddressException;
> +
> +import net.customware.gwt.dispatch.shared.ActionException;
> +
> +import org.apache.hupa.server.FileItemRegistry;
> +import org.apache.hupa.shared.rpc.SendMessage;
> +
> +public class AbtractSendMessageHandlerTest extends AbstractHandlerTest {
> +
> +
> +    FileItemRegistry registry = null;
> +
> +    AbstractSendMessageHandler<SendMessage> handler = new AbstractSendMessageHandler<SendMessage>(logger,
registry, storeCache, httpSessionProvider, "demo-mode", 25, false, false){
> +        protected Message createMessage(Session session, SendMessage action) throws
AddressException, MessagingException, ActionException {
> +            return null;
> +        }
> +        public Class<SendMessage> getActionType() {
> +            return null;
> +        }
> +    };
> +
> +    public void testHtmlmessageToText() {
> +        String txt, res;
> +        txt = "<div>Hola:</div>Como \n estas<br/>Adios\n\n";
> +        res = handler.htmlToText(txt);
> +        assertEquals("Hola:\nComo estas\nAdios ", res);
> +    }
> +
> +}
>
> Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java
(original)
> +++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/handler/GetMessageDetailsHandlerTest.java
Sat Nov 21 09:10:09 2009
> @@ -121,15 +121,6 @@
>
>     }
>
> -    public void testHtmlIsWrapped() throws Exception {
> -
> -        String html = handler.filterHtmlDocument("whatever", "foldername", 111l);
> -        assertEquals("<div class='hupa-email-content'>\nwhatever\n</div>\n",
html);
> -
> -        html = handler.txtDocumentToHtml("whatever", "foldername", 111l);
> -        assertEquals("<div class='hupa-email-content'>\nwhatever\n</div>\n",
html);
> -    }
> -
>     public void testTextDocumentToHtml() throws Exception {
>
>         String msg = "...\nhttp://www.example.com/path/action.do;s=1;a=2?p=abcd\n...";
> @@ -167,11 +158,11 @@
>         msg = "...\n...<img   \n   src=\"cid:1.1934304663@web28309.mail.ukl.yahoo.com\"
width=200\n....";
>         res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
>         assertNotSame(msg, res);
> -        assertEquals("<div class='hupa-email-content'>\n...\n...<img  
\n   src=\"" +
> +        assertEquals("...\n...<img   \n   src=\"" +
>                 SConsts.HUPA + SConsts.SERVLET_DOWNLOAD + "?"
>                 + SConsts.PARAM_FOLDER + "=aFolder&"
>                 + SConsts.PARAM_UID + "=9999&"
> -                + SConsts.PARAM_NAME + "=1.1934304663@web28309.mail.ukl.yahoo.com\"
width=200\n....\n</div>\n", res);
> +                + SConsts.PARAM_NAME + "=1.1934304663@web28309.mail.ukl.yahoo.com\"
width=200\n....", res);
>
>         msg = "\n\n.... <Script \ntype=\"whatever\"\n>\nalert('hello');\n</script
> ---\n\n";
>         res = handler.filterHtmlDocument(msg, "aFolder", 9999l);
>
> Modified: james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/editor/Editor.java
> URL: http://svn.apache.org/viewvc/james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/editor/Editor.java?rev=882863&r1=882862&r2=882863&view=diff
> ==============================================================================
> --- james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/editor/Editor.java
(original)
> +++ james/hupa/trunk/widgets/src/main/java/org/apache/hupa/widgets/editor/Editor.java
Sat Nov 21 09:10:09 2009
> @@ -34,16 +34,16 @@
>     public Editor() {
>         area.ensureDebugId("hupa-editor-area");
>         // Note: rich-area is created in an iframe, so Hupa's style sheets
> -        // are not available, unless we inject then to the generated iframe
> +        // are not available, unless we inject them to the generated iframe
>         area.setSize("100%", "20em");
>
>         Toolbar toolbar = new Toolbar(area);
>         toolbar.ensureDebugId("hupa-editor-toolbar");
> -        toolbar.setWidth("100%");
>
> -        setStyleName("hupa-editor");
> -        add(toolbar);
> -        add(area);
> +        super.setStyleName("hupa-editor");
> +        super.add(toolbar);
> +        super.add(area);
> +        super.setWidth("100%");
>
>     }
>
> @@ -51,13 +51,23 @@
>     public void setSize(String width, String height) {
>         area.setSize(width, height);
>     }
> +
> +    @Override
> +    public void setWidth(String width){
> +        area.setWidth(width);
> +    }
> +
> +    @Override
> +    public void setHeight(String height){
> +        area.setHeight(height);
> +    }
>
>     public String getHTML() {
>         return area.getHTML();
>     }
>
>     public void setHTML(String html) {
> -        area.setHTML(html);
> +        area.setHTML("<font style='font-family: arial' size=2>" + html + "</font>");
>     }
>
>     public String getText() {
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
> For additional commands, e-mail: server-dev-help@james.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message