cancel
Showing results for 
Search instead for 
Did you mean: 

DNDUpload in dashlet

_jan
Champ on-the-rise
Champ on-the-rise
Hello, I am trying to put in my dashlet option to upload document, I added there custom button and I have event for it.

if (null == this.fileUpload) {
    this.fileUpload = Alfresco.getFileUploadInstance();
}
var multiUploadConfig =
{
    siteId: this.options.componentId,
    containerId: this.options.componentId,
    path: destination,
    filter: [],
    mode: this.fileUpload.MODE_MULTI_UPLOAD,
}
this.fileUpload.show(multiUploadConfig);

This code return javascript error :
Uncaught Error: No instance of uploader type 'Alfresco.DNDUpload' exists.


In
.ftl
file of my dashlet I include this :

<@script type="text/javascript" src="${page.url.context}/res/components/upload/dnd-upload.js"></@script>
<@script type="text/javascript" src="${page.url.context}/res/components/upload/file-upload.js"></@script>
<@script type="text/javascript" src="${page.url.context}/res/components/upload/html-upload.js"></@script> 
<@script type="text/javascript" src="${page.url.context}/res/components/upload/flash-upload.js"></@script>
1 REPLY 1

tonyrivet
Champ in-the-making
Champ in-the-making
Hi Jan,

You have to add the uploader components in the template instance of the page :

      <!– Uploaders –>
      <component>
         <region-id>html-upload</region-id>
         <url>/components/upload/html-upload</url>
      </component>
      <component>
         <region-id>flash-upload</region-id>
         <url>/components/upload/flash-upload</url>
      </component>
      <component>
         <region-id>file-upload</region-id>
         <url>/components/upload/file-upload</url>
      </component>
      <component>
         <region-id>dnd-upload</region-id>
         <url>/components/upload/dnd-upload</url>
      </component>
      <component>
         <region-id>archive-and-download</region-id>
         <url>/components/download/archive</url>
      </component>


As you want it in a dashlet, and as the dashboard does not have a single template instance, it's a bit more complicated.
I think you'll have to add the uploaders in each one of the dashboard template instances : dashboard-1-column.xml, dashboard-2-columns-wide-left.xml, …