• XPages and 8.5 Discussion Template a Fix for the File Download Control20090428 07:49


    Many people have been asking for my help with a problem with the 8.5 Discussion template's File Download control.  The reason is that I have an example of a Custom Control for storing file attachments in a central database which uses the File Download control and has the same issue.

    The issue with the File Download control in XPages is that it does not launch Microsoft attachments properly when using Internet Explorer.  The secondary issue is that it throws an exception if your database is in a subdirectory.  You can read the details here in the 8.5 Discussion forum.  

    Last week Irina Kojevnikova posted a solution to the problem.  Her solution overrides the File Download control's HREF for each attachment.  

    Here is a description of the solution:

    On the All Properties tab for the File Download control, there is a property fileNameHrefValue which is computable.

    Image:John's Blog - XPages and 8.5 Discussion Template - a Fix for the File Download Control


    The JavaScript for the value computes the url for each attachment by referencing the current row using the data->var property value rowData.  As the control loops through the attachments, we can get the name of each attachment by using rowData.getName(). Now we can use the filename to build a new url for each attachment.

    Image:John's Blog - XPages and 8.5 Discussion Template - a Fix for the File Download Control


    The data var property is set on the All properties tab under the data section.
    Image:John's Blog - XPages and 8.5 Discussion Template - a Fix for the File Download Control

    The end result is a url similar to: http://localhost/TestDiscussion.nsf/0/A8364817576EF43F852575A30043E76D/%24FILE/JohnExcel.xls

    One issue I could not completely resolve was that if the user attaches files and the document has not been saved yet, the new url will not work since it is using the universalID.  Most likely the person that uploads a file will not try and launch it immediately, though they might want to delete it.  So I replaced the href with "#" if it is a new document so there will not be an error message if the user clicks on the file...it will do nothing.  If anyone has a suggestion on a different approach, please let me know.

    I updated the discussion8.ntf template with the fix and you can download that here: discussion8.ntf.  You will need to sign the database with a production id for use on your server, or sign the 3 custom controls I updated: mainTopic, response, and viewTopic.  I also updated my Custom Control for storing file attachments in a central database with the fix.

    Thank you to Irina for putting together a solution!  Also, a special thanks to Richard Cotrim who spent some time this weekend testing the solution.
  • 相关阅读:
    LeetCode 773. Sliding Puzzle
    oracle latch工作原理
    Oracle关于锁的几种类型和参数
    Java的反射机制
    JAVA多线程与并发学习总结
    Spring 概念详解
    Spring的AOP
    spring面试题 对DI , AOP概念的理解
    双11的架构
    Java线程的定义
  • 原文地址:https://www.cnblogs.com/hannover/p/1971244.html
Copyright © 2020-2023  润新知