cancel
Showing results for 
Search instead for 
Did you mean: 

Share: Own Dashlet - File upload

ebi70
Champ in-the-making
Champ in-the-making
Hi,

I am not so confirm with JSPs.

What I want is a own dashlet with a File Upload Button.
The Own Dashlet I have created, also a Button is available there.
But now is my problem, how to integrate there the file upload functionality.
As I am not so confirm with JSPs, I do not really not, what all I must include!

Has this anybody done till now?
Or, can anybody assist me and explain, what all I must include!
Can I include the existing functionality of "Document Linbrary - upload funtion"?

Any help would be wellcome.

Thanks,
Sven
5 REPLIES 5

ebi70
Champ in-the-making
Champ in-the-making
Hi,

nobody here whi could help me?
I created now my dashlet and inserted in my …get.html.ftl file following code:
<script type="text/javascript">//<![CDATA[
   new Alfresco.DocListToolbar("${args.htmlid}").setOptions(
   {
      siteId: "${page.url.templateArgs.site!""}"
   }).setMessages(
      ${messages}
   );
//]]></script>


<script type="text/javascript" src="http://yui.yahooapis.com/2.7.0/build/yahoo/yahoo-min.js" ></script>

<div id="${args.htmlid}-body" class="dashlet dokument-einreichen">
  <div class="title">${msg("header.dokEinreichen")}</div>
  <div class="file-upload hideable DocListTree"><button id="${args.htmlid}-fileUpload-button" name="fileUpload">${msg("link.dokEinreichen")}</button></div>  
  <div class="body scrollableList"></div>
</div>
Also included several existing js files in my …head.ftl file.
But when I log on in share I get now following error message:
Alfresco.DocListToolbar is not a constructor

Where and how must I define it then?
Why is it nor a constructor?
I copied this part from toolbar.get.html.ftl

Thanks for any help!
Sven

mikeh
Star Contributor
Star Contributor
Hi

Apologies - I don't have time to go into detail on this right now. A few pointers however: you need to include the file-upload, flash-upload and html-upload assets. The DoclistToolBar is defined in toolbar.js in the documentlibrary component, but you shouldn't need it for just upload - have a look at how it kicks off the upload components though as a reference.

One other point - don't include YUI yourself; it's already on the page.

Thanks,
Mike

ebi70
Champ in-the-making
Champ in-the-making
Dear Mike,

Thanks for your quick answer and informations.
I think I have done the most!
Foloowing come my files:
1. uploadtest.get.desc.xml
<webscript>
   <shortname>Beitrag einreichen</shortname>
   <description>Beitrag Einreichen Dashlet</description>
   <family>user-dashlet</family>
   <url>/components/dashlets/uploadtest</url>
   <authentication>user</authentication>
</webscript>

2. uploadtest.get.head.ftl
<!– My Sites Assets –>
<link rel="stylesheet" type="text/css" href="${page.url.context}/components/upload/file-upload.js"/>
<link rel="stylesheet" type="text/css" href="${page.url.context}/components/upload/flash-upload.js"/>
<link rel="stylesheet" type="text/css" href="${page.url.context}/components/upload/html-upload.js"/>
<!– Simple Dialog Assets –>
<script type="text/javascript" src="${page.url.context}/modules/simple-dialog.js"></script>
<script type="text/javascript" src="${page.url.context}/modules/permissions/permissions.js"></script>
<script type="text/javascript" src="${page.url.context}/modules/permissions/permissions.css"></script>
3. uploadtest.get.html.ftl
<div id="${args.htmlid}-body" class="dashletuploadtest">
  <div class="title">${msg("header.dokEinreichen")}</div>
  <div class="file-upload hideable DocListTree"><button id="${args.htmlid}-fileUpload-button" name="fileUpload">${msg("link.dokEinreichen")}</button></div>  
  <div class="body scrollableList">  </div>
</div>

So, when I now log in, and click on my button in my dashlet - nothing happens!
So, for me it is at the moment not clear, must I include something in "uploadtest.get.js", or can I not use the included functionality from file-upload.js, etc.

Thnaks!
Best regards,
Sven

ebi70
Champ in-the-making
Champ in-the-making
Anybody here who could help me?

I included in "uploadtest.get.js" a few functions from toolbar.js
I tried it as explained above, but when I login again in share, then I got following error message:
   Failed to load script '/user-dashlets/uploadtest.get.js (in classpath store file:D:/server/Alf_Labs/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts)': ReferenceError: "Alfresco" is not defined. (file:D:/server/Alf_Labs/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/user-dashlets/uploadtest.get.js#3)
   
Where must I define Alfresco, or must I include another file in "uploadtest.get.head.ftl"?

Anyhelp wellcome!

Thanks!
Best regards,
Sven

max12
Champ in-the-making
Champ in-the-making
Hi,

Does anybody have a solution to this. I am trying the same thing.
How do i have to include the file-upload, flash-upload and html-upload assets and where?

Thanks,
Max