[AWPR-5] Not able to upload using awprmyspaces Created: 17/Jul/09  Updated: 22/Jul/09  Resolved: 21/Jul/09

Status: Resolved
Project: Alfresco Web script Portlet rivet
Component/s: awpr-jboss-portal
Affects Version/s: 1.3.0
Fix Version/s: 1.5.0

Type: Bug Priority: Major
Reporter: nilendra Assignee: Al El-Nattar
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment: alfresco 3.0 labs and liferay5.2.3

Attachments: File awpr-example-webscripts.amp    
Resolution Date:

 Description   
I applied patch through awpr-example-webscripts.amp in alfresco every thing seem to be working fine except upload . I dont know what goes wrong . I am authenticating using star as admin/ admin and admin can upload document in the folder which ia trying. I am able to upload running the webscript directly.but not when using awpr and liferay. I have attached the example amp file

 Comments   
Comment by Al El-Nattar [ 17/Jul/09 ]
Hi,

There is a bug in the example Web scripts AMP that was released with AWPr 1.3.0. Please try to upgrade to AWPr 1.5.0 and let us know if you still see this problem.

Cheers.
Comment by nilendra [ 20/Jul/09 ]

Thanks Alaaedin,
I am still facing problem with upload using AWPr 1.5 .Upload script works fine when I hit webscript directly
uploadOk and then uploadCompleteHandleris called when i hit the link directly.But when I hit it using awpr only uploadOK function is called. getContextPath() is print as blank instead of /alfresco


 uploadOK: function(actionEl, path)
   {
      if (this.fileInput.value.length > 0)
      {
alert ('length' +this.fileInput.value + getContextPath());
         // call the upload help to perform the upload
         handleUploadHelper(this.fileInput,
                            "1", // TODO: generate unique ID? (parent space noderef?)
                            MySpaces.uploadCompleteHandler,
                            getContextPath(),
                            "/ajax/invoke/FileUploadBean.uploadFile",
                            {currentPath: path.replace("_%_", "'")}); // decode path

         this.fileInput = null;
      }
      this.closePopupPanel();
   },
   
   /**
    * Callback function executed after the upload of a new file is complete
    */
   uploadCompleteHandler: function(id, path, fileName, error)
   {
alert('Upload Completed');
      if (error == null)
      {

         MySpaces.refreshList();
      }
      else
      {
         alert("ERROR: " + error);
      }
      if (this.fxOverlay)
      {
         this.fxOverlay.start(0);
      }
   },
Comment by Al El-Nattar [ 21/Jul/09 ]
The examples webscript AMP provided with AWPr 1.3.0 has this bug. You should be using the one bundled with AWPr 1.5.0. You can also download it from the AWPr download page:

http://wiki.rivetlogic.com/download/attachments/4983599/awpr-example-webscripts-1.5.0.amp?version=1

The fixed version should look like this:

uploadOK: function(actionEl, path)
   {
      if (this.fileInput.value.length > 0)
      {
         // call the upload help to perform the upload
         handleUploadHelper(this.fileInput,
                            "1", // TODO: generate unique ID? (parent space noderef?)
                            MySpaces.uploadCompleteHandler,
                            getContextPath(),
                            MySpaces.AlfUrl + "/ajax/invoke/FileUploadBean.uploadFile",
                            {currentPath: path.replace("_%_", "'")}); // decode path
         this.fileInput = null;
      }
      this.closePopupPanel();
   },
 
Comment by nilendra [ 22/Jul/09 ]
Thanks,
As suggested, we applied amp patch from http://wiki.rivetlogic.com/download/attachments/4983599/awpr-example-webscripts-1.5.0.amp?version=1

it has uploadOK and we are able to upload content when calling the Alfresco webscript url directly .

However AWprMySpaces portlet has got broken and doesnt display anything. Following is the URI setting I did in the portlet prefences:
 http://3.209.35.66:8081/alfresco/service/ui/awprmyspaces?f=0&p=/Company%20Home/Sites&t=TICKET_4874b92907b220406dde32219f487106d9efeb03&alfUrl=http://3.209.35.66:8081/alfresco
[this works fine when called directly]
When we set this url using awpr1.5 preference setting, nothing is displayed. in console we have logger showing incorrect uri. (aling with the uri settings as detailed above)
Comment by Al El-Nattar [ 22/Jul/09 ]
Since the My Spaces Web script makes AJAX calls you run into cross-domain security issues if you access the script this way from AWPr.

The portal's URL and Alfresco's URL must use the same domain name (including port number), so the only way to do this would be via a proxy (e.g. mod_jk).

We have a page on the AWPr wiki that explains this and shows you what the AWPr preference values should look like for awprmyspaces:

http://wiki.rivetlogic.com/display/AWPr/Example+Web+scripts

Hope this helps.
Generated at Sat Feb 10 05:46:00 GMT 2024 using Jira 8.1.3#801003-sha1:6b6f07cffadda9a0d6efe24639daed8ce94dcdd6.