[mapguide-users] Ajax viewer, URL in Properties Pane

RenoSun renolionheart at gmail.com
Tue Feb 7 09:04:19 PST 2017


Hi Gom,

I am using nvarchar(255) as the data type of my HTML hyperlink.

Here is the HTML hyperlink field looks like on our SQL Server 2008 R2:

 <http://server/rest/data/PropertyReport/1003.html> 
<http://server/myrest/images/Doc.png> Property Report  

Also, maybe use target="_blank" in your hyperlink like mine, so the user can
see your PDF in the new window.

However, you can choose just store simple URL such as
"http://server/rest/data/PropertyReport/1003.html", but you will have to add
codes in propertyctrl.templ.

Check if a Javascript string is a url
<http://stackoverflow.com/questions/5717093/check-if-a-javascript-string-is-a-url>  

function ValidURL(str) {
  var pattern = new RegExp('^(https?:\/\/)?'+ // protocol
    '((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|'+ // domain name
    '((\d{1,3}\.){3}\d{1,3}))'+ // OR ip (v4) address
    '(\:\d+)?(\/[-a-z\d%_.~+]*)*'+ // port and path
    '(\?[;&a-z\d%_.~+=-]*)?'+ // query string
    '(\#[-a-z\d_]*)?$','i'); // fragment locater
  if(!pattern.test(str)) {
    alert("Please enter a valid URL.");
    return false;
  } else {
    return true;
  }
}

function generateHTMLLink(linkName,href)
{
      return " " + linkName+ " <\"">  "; 
}

Please see the example code here...
propertyctrl.txt
<http://osgeo-org.1560.x6.nabble.com/file/n5306766/propertyctrl.txt>  


Cheers,
Reno



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306766.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list