Author: sebawagner
Date: Mon May 14 17:07:55 2012
New Revision: 1338294

URL: http://svn.apache.org/viewvc?rev=1338294&view=rev
Log:
OPENMEETINGS-269 Image Download Issue from the Whiteboard - Naming problem and 
Deletion.jpg file - Reported by George Kirkham

Modified:
    
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/items/listPresentationFilePDFExplorer.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationFilesList.lzx
    
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationPreview.lzx
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/DownloadHandler.java

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/items/listPresentationFilePDFExplorer.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/items/listPresentationFilePDFExplorer.lzx?rev=1338294&r1=1338293&r2=1338294&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/items/listPresentationFilePDFExplorer.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/items/listPresentationFilePDFExplorer.lzx
 Mon May 14 17:07:55 2012
@@ -26,8 +26,14 @@
     <attribute name="pdfname" value="null" />
     <attribute name="swfName" value="null" />
     
+    <attribute name="fileExplorerItemId" value="-1" type="number" />
+    
     <method name="loadFileByName" args="filename">
-        lz.Browser.loadURL(this.formatURL(filename),'_parent');
+       <![CDATA[
+               var lzURLToLoad = 
this.formatURL(filename)+"&fileExplorerItemId="+this.fileExplorerItemId;
+               if ($debug) Debug.write("lzURLToLoad ",lzURLToLoad);
+               lz.Browser.loadURL(lzURLToLoad,'_parent');
+        ]]>
     </method>
 
     <handler name="onclick">

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationFilesList.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationFilesList.lzx?rev=1338294&r1=1338293&r2=1338294&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationFilesList.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationFilesList.lzx
 Mon May 14 17:07:55 2012
@@ -37,14 +37,29 @@
                                                
uploadmodul:this.uploadmodul,thumbname:thumbName,no:no});
     </method>
     
-    <method name="addListpresentationFileOrig" 
args="originalName,pdfname,swfName">
-        new 
lz.listPresentationFileOrigExplorer(this._table._listcontent,{isExplorer:true,
-                                       
isoriginal:true,uploadmodul:this.uploadmodul,
-                                       
originalName:originalName,pdfname:pdfname,swfName:swfName});
+    <method name="addListpresentationFileOrig" 
args="originalName,pdfname,swfName,fileExplorerItemId">
+       if ($debug) Debug.write("addListpresentationFileOrig 
",originalName,pdfname,swfName,fileExplorerItemId);
+        new lz.listPresentationFileOrigExplorer(this._table._listcontent,{
+                                               isExplorer:true,
+                                               isoriginal:true,
+                                               uploadmodul:this.uploadmodul,
+                                               originalName:originalName,
+                                               pdfname:pdfname,
+                                               swfName:swfName,
+                                               
fileExplorerItemId:fileExplorerItemId
+                                       });
     </method>
     
-    <method name="addListpresentationFilePDF" args="pdfname,swfName">
-        new 
lz.listPresentationFilePDFExplorer(this._table._listcontent,{isExplorer:true,isoriginal:true,uploadmodul:this.uploadmodul,pdfname:pdfname,swfName:swfName});
+    <method name="addListpresentationFilePDF" 
args="pdfname,swfName,fileExplorerItemId">
+       if ($debug) Debug.write("addListpresentationFilePDF 
",originalName,pdfname,swfName,fileExplorerItemId);
+        new lz.listPresentationFilePDFExplorer(this._table._listcontent,{
+                                               isExplorer:true,
+                                               isoriginal:true,
+                                               uploadmodul:this.uploadmodul,
+                                               pdfname:pdfname,
+                                               swfName:swfName,
+                                               
fileExplorerItemId:fileExplorerItemId
+                                       });
     </method>
            
     <method name="resetList">

Modified: 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationPreview.lzx
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationPreview.lzx?rev=1338294&r1=1338293&r2=1338294&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationPreview.lzx
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/WebContent/src/modules/conference/tabcontent/fileexplorer/presentations/presentationPreview.lzx
 Mon May 14 17:07:55 2012
@@ -38,7 +38,8 @@
        
        <method name="addFolderSequence">
         <![CDATA[
-        if ($debug) Debug.write("foldername ",this.documentObj.fileHash);
+        if ($debug) Debug.write("foldername 1 ",this.documentObj.fileHash);
+        if ($debug) Debug.write("foldername 2 
",this.documentObj.fileExplorerItemId);
         canvas.uploadmoduleimgfolder = '/'+this.documentObj.fileHash;
         this.getPresentationPreviewFileExplorer.doCall();
         ]]>
@@ -62,14 +63,14 @@
             
             if ($debug) Debug.write("presentationObject: ",presentationObject);
         
-            if (typeof(presentationObject.pdfDocument)=="undefined"){
+            if (presentationObject.pdfDocument==null){
                 //Is PDF only
                 //Debug.write("Is PDF only");
-                
this._imageslistdraw.addListpresentationFilePDF(presentationObject.originalDocument,presentationObject.swfDocument);
+                
this._imageslistdraw.addListpresentationFilePDF(presentationObject.originalDocument,presentationObject.swfDocument,this.documentObj.fileExplorerItemId);
             } else {
                 //Is original Document + PDF-Document
                 //Debug.write("Is original Document + PDF-Document");
-                
this._imageslistdraw.addListpresentationFileOrig(presentationObject.originalDocument,presentationObject.pdfDocument,presentationObject.swfDocument);
+                
this._imageslistdraw.addListpresentationFileOrig(presentationObject.originalDocument,presentationObject.pdfDocument,presentationObject.swfDocument,this.documentObj.fileExplorerItemId);
             }
         
             for (var eg=0;eg<presentationObject.thumbs.thumbs.length;eg++){

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/DownloadHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/DownloadHandler.java?rev=1338294&r1=1338293&r2=1338294&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/DownloadHandler.java
 (original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/DownloadHandler.java
 Mon May 14 17:07:55 2012
@@ -32,7 +32,9 @@ import javax.servlet.http.HttpServletRes
 import org.apache.commons.lang.StringUtils;
 import org.openmeetings.app.OpenmeetingsVariables;
 import org.openmeetings.app.data.basic.Sessionmanagement;
+import org.openmeetings.app.data.file.dao.FileExplorerItemDaoImpl;
 import org.openmeetings.app.data.user.Usermanagement;
+import org.openmeetings.app.persistence.beans.files.FileExplorerItem;
 import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -76,6 +78,19 @@ public class DownloadHandler extends Htt
                }
                return null;
        }
+       
+       public FileExplorerItemDaoImpl getFileExplorerItemDaoImpl() {
+               try {
+                       if (ScopeApplicationAdapter.initComplete) {
+                               ApplicationContext context = 
WebApplicationContextUtils
+                                               
.getWebApplicationContext(getServletContext());
+                               return (FileExplorerItemDaoImpl) 
context.getBean("fileExplorerItemDao");
+                       }
+               } catch (Exception err) {
+                       log.error("[getUserManagement]", err);
+               }
+               return null;
+       }
 
        private void logNonExistentFolder(String dir) {
                File f = new File(dir);
@@ -151,6 +166,15 @@ public class DownloadHandler extends Htt
                                if (requestedFile == null) {
                                        requestedFile = "";
                                }
+                               
+                               String fileExplorerItemIdParam = 
httpServletRequest
+                                               
.getParameter("fileExplorerItemId");
+                               Long fileExplorerItemId = null;
+                               if (fileExplorerItemIdParam != null) {
+                                       fileExplorerItemId = 
Long.parseLong(fileExplorerItemIdParam);
+                               }
+                               
+                               
 
                                // make a complete name out of 
domain(organisation) + roomname
                                String roomName = room_id;
@@ -350,18 +374,30 @@ public class DownloadHandler extends Htt
                                        } else {
                                                httpServletResponse
                                                                
.setContentType("APPLICATION/OCTET-STREAM");
+                                               
+                                               String fileNameResult = 
requestedFile;
+                                               if (fileExplorerItemId != null 
&& fileExplorerItemId > 0) {
+                                                       FileExplorerItem 
fileExplorerItem = 
getFileExplorerItemDaoImpl().getFileExplorerItemsById(fileExplorerItemId);
+                                                       if (fileExplorerItem != 
null) {
+                                                               
+                                                               fileNameResult 
= fileExplorerItem.getFileName().substring(0, 
fileExplorerItem.getFileName().length()-4)
+                                                                               
                        + fileNameResult.substring(fileNameResult.length()-4, 
fileNameResult.length());
+                                                               
+                                                       }
+                                               }
+                                               
                                                if (browserType == 0) {
                                                        
httpServletResponse.setHeader(
                                                                        
"Content-Disposition",
                                                                        
"attachment; filename="
                                                                                
        + java.net.URLEncoder.encode(
-                                                                               
                        requestedFile, "UTF-8"));
+                                                                               
                        fileNameResult, "UTF-8"));
                                                } else {
                                                        
httpServletResponse.setHeader(
                                                                        
"Content-Disposition",
                                                                        
"attachment; filename*=UTF-8'en'"
                                                                                
        + java.net.URLEncoder.encode(
-                                                                               
                        requestedFile, "UTF-8"));
+                                                                               
                        fileNameResult, "UTF-8"));
                                                }
 
                                                
httpServletResponse.setHeader("Content-Length",


Reply via email to