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
  #1 (permalink)  
Old 08-16-2010, 05:41 PM
New Member
 
Posts: 3
Default Upload files from local disk to briefcase from Zimlet

I am trying to write a Zimlet that should work with briefcase - I need to upload files and rename them according to certain naming convention. It should be very simple, but I really can't get it.

I have already tried even to look into ZmUploadDialog.js source and copy-paste functions from there but it gives me an error
Code:
guids is undefined
on

Code:
com_itdassist_register_inbound_HandlerObject.prototype._uploadSaveDocs =
function(files, status, guids) {
    guids = guids.split(",");
    ...
As far as I understand, guids should be returned by uploadMgr.execute after
Code:
    var callback = new AjxCallback(this, this._uploadSaveDocs, [files]);
    var uploadForm = document.getElementById("registerInbound_form");
    var uploadMgr = appCtxt.getUploadManager();
    window._uploadManager = uploadMgr;
    try {
        uploadMgr.execute(callback, uploadForm);
    ...
But it does not work for me.

Could anybody be so kind and point me to the right way either:
(a) what is wrong with my implementation taken from ZmUploadDialog?
or
(b) what is the simpliest way to just upload file from local disk to briefcase and rename it?
Reply With Quote
  #2 (permalink)  
Old 04-03-2011, 02:43 AM
Starter Member
 
Posts: 1
Post Uploading files from Zimlet

If you want to call the uploading file dialog you have to do the following:

Quote:
// Get the id of folder where you want to upload your file
var folderId = ZmOrganizer.ID_BRIEFCASE;

// Setting up callback for new file creation (will be called if file is successfuly uploaded)
this._insertObjectsCallback = new AjxCallback(this,this._insertObjects);

// Check access permissions for selected folder
if(this._chkFolderPermission(folderId)) {

// Getting folder by ID
var cFolder = appCtxt.getById(folderId);

// Get upload dialog for selected folder with defined callback and popup it
appCtxt.getUploadDialog().popup(cFolder, this._insertObjectsCallback, "Upload new file");
}
Call back function should be defined as following:

Quote:
your_zimlet_name.prototype._insertObjects =
function(func, folder, filenames, files) {
// Some actions
}

This method was grabed from ZImbra source. All this functions are not listed in API reference. Actually "getUploadDialog()" is in the reference, but there are no "popup()" function with describing of input parameters.

I also have question for others: is it possible to upload file in a different folder (not in standard briefcase). I need file to be in shared folder and I know only the name of this folder, not it's ID?
Reply With Quote
  #3 (permalink)  
Old 07-01-2011, 12:56 AM
Active Member
 
Posts: 28
Default

Can one of you please share the complete zimlet code? I am trying to achieve some thing similar and any reference could be of great assistance..
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.