Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Attach

  1. #11
    jasonhell is offline Intermediate Member
    Join Date
    Mar 2008
    Posts
    22
    Rep Power
    7

    Default

    Sorry, where I must put this class? and how I call it?
    I only use jsp class e js code of zimlet!

    my structure is this:

    a file xml where I define the zimlet
    a file js where I implement the zimlet
    a file css
    a file jsp that I call by js file to load the documents from KT with webservices API


    excuse for the lack of familiarity

  2. #12
    mahmoud is offline Senior Member
    Join Date
    Jun 2008
    Location
    Dubai
    Posts
    53
    Rep Power
    7

    Default

    you need at least a servlet to run the attachment , are you familiar with servlets?
    if so try to make that code work with you :

    description :The AttachmentServlet gets the stream from a given part of a multipart message and pushes it out to the browser with the correct content type. This servlet is used to display attachments and it relies on the browser's content handling capabilities.
    Message msg =
    mailuser.getFolder().getMessage(msgNum);

    Multipart multipart = (Multipart)msg.getContent();
    Part part = multipart.getBodyPart(partNum);

    String sct = part.getContentType();
    if (sct == null) {
    out.println("invalid part");
    return;
    }
    ContentType ct = new ContentType(sct);

    response.setContentType(ct.getBaseType());
    InputStream is = part.getInputStream();
    int i;
    while ((i = is.read()) != -1)
    out.write(i);
    out.flush();
    out.close();

  3. #13
    mahmoud is offline Senior Member
    Join Date
    Jun 2008
    Location
    Dubai
    Posts
    53
    Rep Power
    7

    Default

    webapp.zip
    sorry i forgot to upload that file so everything will work for you

    description:The EWA is comprised of an HTML document and several web components (servlets and JSP and custom tags). Apart from these, it has two directories, META-INF and WEB-INF.

    The META-INF directory contains:The manifest file for the application.

    The WEB-INF directory contains:
    The web.xml file which contains the configuration and deployment information for the application.
    The classes directory which contains servlet and utility classes used by the web application.
    The lib directory which contains the java archive file (jtl.jar) for the custom tag library.

  4. #14
    jasonhell is offline Intermediate Member
    Join Date
    Mar 2008
    Posts
    22
    Rep Power
    7

    Default

    Sorry,
    perhaps I explained evil,

    I 've a zimlet, written in Javascript, from which I want to adding an attachment at the current mail message. I never use java file into a Zimlet, and never I read how develop this.

    I have that method, in javascript

    //this method add a tag "Attach from Kt"
    Com_Zimbra_Ktconnector.prototype.addKTTabToAttachD ialog = function()
    {

    var attachdlg = this._attachdlg = appCtxt.getAttachDialog ();
    var tabview = attachdlg ? attachdlg.getTabView () : null;
    this.FTV = new KTTabView (tabview, this);
    var tabkey = attachdlg.addTab ("kt", "kt docs", this.FTV);



    attachdlg.addOkListener (tabkey, new AjxCallback (this, this.onKtLoaderDlgInsertFolder));

    }
    //now I insert the kt folder from which select the documents
    Com_Zimbra_Ktconnectorvm13d.prototype.onKtLoaderDl gInsertFolder = function()
    {


    ;

    var d = this.InsertFolderDlg._getContentDiv (); /* Initialize the Upload Dialog */
    _clearElement (d);

    var div = document.createElement ("div");
    var titleS = document.createElement ("span");
    titleS.className = "Yflickr_hLeft";
    titleS.appendChild (document.createTextNode ("KT Folder (Necessary): "));
    var titleI = document.createElement ("input");
    titleS.appendChild (titleI);
    div.appendChild (titleS);
    d.appendChild (div);

    this.InsertFolderDlg.setButtonListener (DwtDialog.OK_BUTTON, new AjxListener (this, function() { this.onKtLoaderDlg (titleI.value); }));

    this.InsertFolderDlg.popup();



    }
    //now, call the jsp loadFile, at the end I've some document url to attach at mail msg.
    Com_Zimbra_Ktconnectorvm13d.prototype.onKtLoaderDl g = function(folder)
    {

    this.KtLoaderDlg = new DwtDialog (appCtxt.getShell(),null,"Upload Document from KnowledgeTree ("+folder+")",[DwtDialog.OK_BUTTON]);

    var d = this.KtLoaderDlg._getContentDiv (); /* Initialize the Upload Dialog */
    _clearElement (d);



    var urlJsp = this.getResource("loadFile.jsp");
    var urlDest = this.getResource("done.jsp");
    var parametri = "?username="+this.getUserProperty("z_username")+"& passwd="+this.getUserProperty("z_password")+"&ktur l="+this.getUserProperty("z_url")+"&ktport="+this. getUserProperty("z_port")+"&folder="+folder+"&urlJ sp="+urlJsp+"&urlDest="+urlDest;

    var d = this.KtLoaderDlg._getContentDiv (); /* Initialize the Upload Dialog */
    _clearElement (d);




    this.KtLoaderDlg.setContent("<iframe src =\"http://zimbuntu.intranet.noze.it"+urlJsp+parametri+"\"wid th=\"100%\"> </iframe>");




    this.KtLoaderDlg.setButtonListener (DwtDialog.OK_BUTTON, new AjxListener (this, function() { this.KtLoaderDlg.popdown(); this.InsertFolderDlg.popdown();}));

    this.KtLoaderDlg.popup();
    }

    Now, I must write a method to attach a document to the mail (from document url).

    It's possible without servlet?
    I need only a method that, given a mail message and a url, attach at mail message the document that is at the url.

    Thanks for your time

  5. #15
    mahmoud is offline Senior Member
    Join Date
    Jun 2008
    Location
    Dubai
    Posts
    53
    Rep Power
    7

    Default

    try this method
    getHtmlContent

    public javax.mail.internet.MimeMultipart getHtmlContent()
    iam sure this one will work for you .

    i dont know what you mean by that!!
    Sorry,
    perhaps I explained evil,

  6. #16
    jasonhell is offline Intermediate Member
    Join Date
    Mar 2008
    Posts
    22
    Rep Power
    7

    Default

    Sorry, I'm not able to take the mailMsg, when I'm writing a mail msg.
    I need to take (from where I don't know) the mailMsg object, but I don't find any help to do it. Done it, I can modify the attachment list, but I do this first

    How can I do it? (From Js, I hope)

    Thanks

  7. #17
    mahmoud is offline Senior Member
    Join Date
    Jun 2008
    Location
    Dubai
    Posts
    53
    Rep Power
    7

    Default

    did you try the code i sent you , or the method.
    IMHO reaching your approach with js only cannot by done.
    you need a servlet to handle requests

    regards

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Attach a file via SOAP API
    By mannes in forum Developers
    Replies: 2
    Last Post: 10-20-2009, 01:31 PM
  2. How to attach an image to a signature
    By kaouki in forum Users
    Replies: 18
    Last Post: 10-19-2009, 12:55 PM
  3. Attach contacts to email?
    By Guest6400 in forum Users
    Replies: 2
    Last Post: 01-31-2008, 12:15 PM
  4. Attach View
    By rajan in forum Administrators
    Replies: 5
    Last Post: 04-24-2007, 02:37 PM
  5. Calendar appointment attach gone ?
    By sperkins in forum Administrators
    Replies: 3
    Last Post: 12-11-2006, 04:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •