Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old 07-01-2008, 06:04 AM
Intermediate Member
 
Posts: 22
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
Reply With Quote
  #12 (permalink)  
Old 07-01-2008, 06:11 AM
Senior Member
 
Posts: 53
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.
Quote:
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();
Reply With Quote
  #13 (permalink)  
Old 07-01-2008, 06:15 AM
Senior Member
 
Posts: 53
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.
Reply With Quote
  #14 (permalink)  
Old 07-01-2008, 06:30 AM
Intermediate Member
 
Posts: 22
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
Quote:

//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
Reply With Quote
  #15 (permalink)  
Old 07-01-2008, 06:47 AM
Senior Member
 
Posts: 53
Default

try this method
Quote:
getHtmlContent

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

i dont know what you mean by that!!
Quote:
Sorry,
perhaps I explained evil,
Reply With Quote
  #16 (permalink)  
Old 07-01-2008, 08:25 AM
Intermediate Member
 
Posts: 22
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
Reply With Quote
  #17 (permalink)  
Old 07-02-2008, 07:09 AM
Senior Member
 
Posts: 53
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.