Display hyperlinks in the Fusion Viewer Selection Panel of MapGuide

Source: Internet
Author: User
Tags i18n

If your data source contains a hyperlink, you can select a feature in Ajax viewer to display the hyperlink when displaying the relevant information of this element in the Selection Panel. However, this feature does not work in Fusion Viewer. hyperlinks are displayed in HTML code, which is not very nice:

 

The solution is to decode the HTML code and modify C: \ Program Files \ Autodesk Infrastructure Web Server Extension 2013 \ www \ fusion \ widgets \ SelectionPanel. in the js file, search for the renderFeature in this file, which is around 384 lines and changed to the following code:

htmlDecode:function(str){var s = "";if(str.length == 0) return "";s =  str.replace(/&gt;/g,   ">");s =  s.replace(/&lt;/g,     "<");s =  s.replace(/&nbsp;/g,   " ");s =  s.replace(/'/g,        "\'");s =  s.replace(/&quot;/g,   "\"");s = s.replace(/<br>/g,      "\n");return s;},renderFeature: function() {var layerIdx = this.layerList.selectedIndex;var featureIdx = this.featureList.selectedIndex;var layerObj = this.oSelection.getLayer(layerIdx);var nProperties = layerObj.getNumProperties();var aNames = layerObj.getPropertyNames();var table = document.createElement('table');var thead = document.createElement('thead');var tr = document.createElement('tr');var th = document.createElement('th');th.innerHTML = OpenLayers.i18n('attribute');tr.appendChild(th);var th = document.createElement('th');th.innerHTML = OpenLayers.i18n('value');tr.appendChild(th);thead.appendChild(tr);table.appendChild(thead);var tbody = document.createElement('tbody');table.appendChild(tbody);for (var i=0; i<nProperties; i++) {var tr = document.createElement('tr');if (i%2) {tr.className = 'oddRow';}var th = document.createElement('th');th.innerHTML = aNames[i];var td = document.createElement('td');td.innerHTML = this.htmlDecode(layerObj.getElementValue(featureIdx, i));tr.appendChild(th);tr.appendChild(td);tbody.appendChild(tr);}this.featureDiv.innerHTML = '';this.featureDiv.appendChild(table);}

Note the comma following the htmlDecode method. Finally, to make the changes take effect, you also need to change the javascript orientation in the template file html. For example, for the Slate template, change C: \ Program Files \ Autodesk Infrastructure Web Server Extension 2013 \ www \ fusion \ templates \ mapguide \ slate \ index.html.

 

<Script type = "text/javascript" src = ".../lib/Fusion. js"> </Script>

 

For debugging, refer to this blog. The above code is tested and passed in Autodesk Infrastructure Map Server 2013. It should also be applicable to MapGuide OpenSource.

 

In addition, this article has been published to ADN DevBlog.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.