需要 Rally HTML 到 return url 而不是附件字符串

Need Rally HTML to return url instead of string for attachment

我正在为拉力赛应用程序使用自定义 html 查询和 return 对象列表及其附件。对于我正在做的事情效果很好,但是尽管在 Rally 的屏幕上我可以单击名称并且它是附件的 link,当我抓住列表并将其粘贴到 excel 时我最终得到只是附件的名称,我真的需要一个 link 到附件。

任何人都可以帮我解决这个 html 以便它 return 是 Rally 中的实际 url 而不是后面带有 url 的名称吗?查看这些图片enter image description here。顶部代表当前结果,而底部代表期望的结果。

     <html>
        <head>
           <title>Story Table</title>
           <meta name="Name" content="Stories with Attachments" />
           <meta name="Version" content="2014.2" />
           <meta name="Vendor" content="Rally Software" />
       <script type="text/javascript" src="https://rally1.rallydev.com/apps/1.32/sdk.js"></script>
       <script type="text/javascript">
             var table = null;

             function tableExample() {
               var rallyDataSource = new rally.sdk.data.RallyDataSource('__WORKSPACE_OID__',
                                                                                    '__PROJECT_OID__',
                                                                                    '__PROJECT_SCOPING_UP__',
                                                                                    '__PROJECT_SCOPING_DOWN__');
              function itemQuery() {
                 var queryObject = {
                   key: 'theItems',
                   type: iType,
                   fetch: 'FormattedID,Name,State,ScheduleState,Description,Attachments,ObjectID',
                   query: Qvalue
                 };
                 rallyDataSource.findAll(queryObject, populateTable);
              }
              function populateTable(results) {
                  if (table) {
                      table.destroy();
                  }
                  var col3 = 'ScheduleState';
                  if (iType == 'task') {
                    col3 = 'State';
                  }
                 var tableDiv = document.getElementById('aDiv');
                 var config = { 'columnKeys'    : ['FormattedID',  'Name', col3,   'Attachments'],
                                'columnHeaders' : ['FormattedID',  'Name', col3,   'Attachments'],
                                'columnWidths'  : ['100px',        '400px', '85px',           '300px']
                               };
                 table = new rally.sdk.ui.Table(config);
                 table.addRows(results.theItems);
                 for (i=0;i<results.theItems.length;i++) {
                     myStory = results.theItems[i];
                     myStoryURL = rally.sdk.util.Context.getServerInfo().getUrl()+"/#/" + '__PROJECT_OID__' + "/detail/"+ iType + "/"+myStory.ObjectID;
                     myStoryHTML = "<div><a href='" + myStoryURL + "' target='_top'> " +
                                 myStory.FormattedID + "</a></div>";
                     myAttachments = results.theItems[i].Attachments;
                     myAttachmentHTML = "";
                     for (j=0;j<myAttachments.length;j++) {
                         myAttachmentOID = myAttachments[j].ObjectID;
                         myAttachmentName = myAttachments[j].Name;
                         myAttachmentURL = rally.sdk.util.Context.getServerInfo().getSlmUrl()+"/attachment/"+
                                 myAttachmentOID + "/" + myAttachmentName;

                         myAttachmentHTML += "<div><a href='" + myAttachmentURL + "'>" +
                                 myAttachmentName + "</a></div>";

                     }
                     table.setCell(i, 3, myAttachmentHTML);
                     table.setCell(i, 0, myStoryHTML);
                 }
                 table.display(tableDiv);
              };
              itemQuery();
             }
             rally.addOnLoad(tableExample);
            </script>

            <script type="text/javascript">
                var Qvalue = '';
                function textBoxChanged(tb, args) {
                    Qvalue = args.value;
                }
                function Qbox() {
                    var config = {
                        label : 'Query String: ',
                        value : '',
                        width: 500,
                        showLabel: true
                    };
                    var textBox = new rally.sdk.ui.basic.TextBox(config);
                    textBox.display("textbox", textBoxChanged);
                }
                rally.addOnLoad(Qbox);
            </script>
            <script type="text/javascript">
                var iType = 'hierarchicalrequirement';
                function typeSelect() {
                function onChanged(c, args) {
                    iType = args.value;
                }
                var config = {
                    radios: [{label:"Stories", value:"hierarchicalrequirement"},{label:"Defects",value:"defect"},{label:"Tasks",value:"task"},{label:"Test Cases",value:"testcase"}],
                    labelPosition: "after",
                    rememberChecked: false,
                    defaultValue: "hierarchicalrequirement", 
                    groupName: "itemTypes"
                };
                var radioButtonGroup = new rally.sdk.ui.basic.RadioButtonGroup(config);
                radioButtonGroup.display("itemGroup", onChanged);
                }
                rally.addOnLoad(typeSelect);
            </script>
</head>
    <body>
        <p><div id="itemGroup"></div><span id="textbox"></span>
        <button onclick="tableExample()">Refresh</button>
            <a href="http://www.rallydev.com/help/grid-queries" target="_blank">Query Help</a>
        <br></p>
        <div id="aDiv" style="overflow-y: auto;"></div>
    </body>
</html>

我假设您仍然希望能够单击应用程序中的附件链接。

所以尝试替换这行代码:

myAttachmentHTML += "<div><a href='" + myAttachmentURL + "'>" + myAttachmentName + "</a></div>";

有了这个:

myAttachmentHTML += "<div><a href='" + myAttachmentURL + "'>" + myAttachmentURL + "</a></div>";