Comment #2 on issue 1431 by [email protected]: Download file in context menu
http://code.google.com/p/openmeetings/issues/detail?id=1431

Hi Sebastian,

I've finish download feature by context menu in file explorer. If you want I can upload my source code to svn.

My solution:
---------------------------------------------------------
- Add download item to language file - english.xml
<string id="1357" name="download_file">
    <value>Download</value>
</string>

- Add attribute and methods to treeitems/baseFileExplorerItems.lzx
    <!-- Duc Vu | Start Download document -->
    <attribute name="uploadmodulefolder" value="" type="string" />

    <method name="addFolderSequence" args="foldername">
        <![CDATA[
                this.uploadmodulefolder = '/';
                this.uploadmodulefolder += foldername;
        ]]>
    </method>

    <method name="makeDocumentHash" args="fhash, fname">
        <![CDATA[
                var documentHash = fhash;
                var pos = fname.lastIndexOf(".");
                        var strlen = fname.length;
                        if (pos != -1 && strlen != pos + 1) {
                                var ext = fname.split(".");
                                var len = ext.length;
                                var extension = ext[len - 1].toLowerCase();
                                documentHash = fhash + "." + extension;
                        }
                        
                        return documentHash;
        ]]>
    </method>

    <method name="downloadDocumentByName">
        lz.Browser.loadURL(this.formatDocumentURL(),'_blank');
    </method>
        
        <method name="formatDocumentURL">
        <![CDATA[
            this.addFolderSequence(this.fileHash);
var documentHash = this.makeDocumentHash(this.fileHash, this.fileName);

var downloadurl = 'http://' + canvas.rtmphostlocal + ':' + canvas.red5httpport +canvas.httpRootKey+'DownloadHandler?' +
                'fileName=' + documentHash +
                '&moduleName=' + "videoconf1" +
                '&parentPath=' + this.uploadmodulefolder + '/'+
                '&room_id=files'+
                '&sid='+canvas.sessionId;
            return downloadurl;
        ]]>
    </method>
    <!-- Duc Vu | End Download document -->

- Add download item to context menu in treeitems/documentFileExplorerItems.lzx
        <contextmenu>
            .................   
            <!-- Duc Vu | Download item -->
            <contextmenuitem caption="$once{ canvas.getLabelName(1357) }"
                                                         
onselect="parent.parent.parent.downloadDocumentByName()" />
        </contextmenu>

- Add download item to context menu in treeitems/imageFileExplorerItems.lzx
        <contextmenu>
            ..............
            <!-- Duc Vu | Download item -->
            <contextmenuitem caption="$once{ canvas.getLabelName(1357) }"
                                                         
onselect="parent.parent.parent.downloadImageByName()" />
                                        
        </contextmenu>
-------------------------------------------------------------------------------

I hope it will useful for someone.

BR.
Duc Vu

--
You received this message because you are subscribed to the Google Groups 
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/openmeetings-dev?hl=en.

Reply via email to