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

2017-02-09 Thread gom
That function does the trick.  Thanks for all the support!



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5307188.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-08 Thread RenoSun
Hey gom,

I think I found the solution.

Please change the HtmlDecode function with following code:

function HtmlDecode(input)
{
var txt = document.createElement("textarea");
txt.innerHTML = input;
return txt.value;
}




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5307071.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-08 Thread gom
OK. I did that and the console shows 4 property values.  The url property
value shows as null, all the other 3 show as they exist in the database.

G20070192
1
null
ADV01




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5307046.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-08 Thread RenoSun
Please copy and paste the code of last propertyctrl.txt that I attached, and
let me know what it print under the console.

The if statement with brackets should look like this I assume:

function HtmlDecode(input)
{
if (input == null || input == ""){
return input;
}
if (_el == null){
_el = document.createElement('div');
}
_el.innerHTML = input;
return _el.childNodes[0].nodeValue;
}




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5307044.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-08 Thread gom
Using the debugger on the browser here is what I am seeing.

When the line /*console.log(input);*/ is included in the HtmlDecode
function, the code path followed is through that first if statement and
return input gives the expected result.

When that same line of code is left out of the function, the code path
followed is the second if statement and /*_el.childNodes[0].nodeValue;*/ is
null for the url field.  _el.innerHTML does hold the correct string.

Does this provide any meaningful information towards what might be
happening?

Thanks






--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306980.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-07 Thread RenoSun
I would think you should try to clean all the browsing data and history to
make sure the browser is using the latest propertyctrl.templ 

Also, don't use alert, but using console.log('abcd') maybe.

Try to use before and after the HtmlDecode.

for(var i=0; i < properties.length; i++)
   *console.log(properties[i].value);*
   *console.log(HtmlDecode(properties[i].value));*
code += '
 ' + properties[i].name + '' + 
HtmlDecode(properties[i].value) + '';





--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306819.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-07 Thread gom
I added some alert statements to the HtmlDecode function, just before the
return statements, in the hopes of gaining some feedback.  Oddly enough, the
function, as shown below, now correctly shows the links in the properties
pane.

Any thoughts?

Thanks again.






--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306804.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-07 Thread gom
When I use the code from the propertyctrl.txt file that is attached, I get no
properties at all.  The console shows no errors.



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306782.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-07 Thread gom
Not a question really but a comment.

When I preview the data source, using "View Data" both in Maestro and
Infrastructure Studio, I see the link exactly as expected in those data
tables. 



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306778.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-07 Thread RenoSun
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:

  
 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

  

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
  


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.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-07 Thread gom
Reno,

Would it be possible to see the exact format of the url string from the
database, for the sample record you showed me?  I have copied and pasted the
string from my database table below.  That string always shows up as null in
my properties window.  I have tried this in SQLite and SQL Server 2008 R2.

All else being equal, I would expect that the problem must be how my string
is stored in SQL Server.

Thanks for all the great support.

Plan PDF   



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306745.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread gom
The XML looks as expected in Maestro.



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306639.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread gom















--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306638.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread RenoSun
Okay...would you please post the codes of your original propertyctrl.templ?

I don't know why add a simple JavaScript function will cause your map window
to hang up... 



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306637.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread gom
Copying and pasting your complete page also causes my map window to hang up.



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306623.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread gom
I'm using Mapguide 3.1 if that matters at all.



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306619.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread gom
No errors in the console window



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306617.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread Gord McKenzie
OK. That code solution fits my scenario.  When I paste these two functions into 
"propertyctrl.templ", replacing the original versions, my map viewer window 
freezes up.  I imagine there is a problem properly loading the 
propertyctrl.templ file and it freezes the map window load.

-Original Message-
From: mapguide-users [mailto:mapguide-users-boun...@lists.osgeo.org] On Behalf 
Of RenoSun
Sent: Monday, February 06, 2017 10:43 AM
To: mapguide-users@lists.osgeo.org
Subject: Re: [mapguide-users] Ajax viewer, URL in Properties Pane

No problem. The solution for Ajax viewer is similar. Please modify the 
following codes.

C:\Program Files\MapGuide\www\viewerfiles\propertyctrl.templ

function SetProperties(count, properties) {
var code;
propCount = count;
if(count != 1)
{
var text;
if(count == 0)
{
text = "__#PROPERTIESNONE#__";
GetMapFrame().SetPropertyPaneToolbarVisibility(false);
}
else
{
text = GetMainFrame().FormatMessage("__#PROPERTIESITEMSEL#__",
new Array(count, "unused"));
GetMapFrame().SetPropertyPaneToolbarVisibility(true);
}
code = '
' + text + '
';
}
else
{
code = '
 __#PROPERTIESNAME#__   __#PROPERTIESVALUE#__';
for(var i=0; i < properties.length; i++)
code += '
 ' + properties[i].name + '' + 
HtmlDecode(properties[i].value) + '';
code += '
';
GetMapFrame().SetPropertyPaneToolbarVisibility(true);
}

SetContent(code);
}

.

var _el = null; //Our "parser" element

function HtmlDecode(input)
{
if (input == null || input == "")
return input;

if (_el == null)
_el = document.createElement('div');

_el.innerHTML = input;
return _el.childNodes[0].nodeValue;
}




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306550.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread RenoSun
Here is the full codes of my propertyctrl.templ



















--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306615.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread RenoSun
I will suggest you undo the modification, and just add function HtmlDecode()
function first.
var _el = null; //Our "parser" element 
function HtmlDecode(input) 
{ 
if (input == null || input == "") 
return input; 

if (_el == null) 
_el = document.createElement('div'); 

_el.innerHTML = input; 
return _el.childNodes[0].nodeValue; 
}  

Then, make sure your HtmlDecode(properties[i].value) the property values.

Please open the Ajax viewer in the web browser, and right click to inspect
the elements, and let me know if there are any error messages under the
Console tab.




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306614.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread gom
This is the correct viewer for my situation.  

When I replace the two functions in propertyctrl.templ, my webpage doesn't
load.  The map window freezes. I assume it is failing when it tries to load
the propertyctrl.templ file.  Any idea why this might happen?

Thanks



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306577.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread RenoSun
No problem. The solution for Ajax viewer is similar. Please modify the
following codes.

C:\Program Files\MapGuide\www\viewerfiles\propertyctrl.templ

function SetProperties(count, properties)
{
var code;
propCount = count;
if(count != 1)
{
var text;
if(count == 0)
{
text = "__#PROPERTIESNONE#__";
GetMapFrame().SetPropertyPaneToolbarVisibility(false);
}
else
{
text = GetMainFrame().FormatMessage("__#PROPERTIESITEMSEL#__",
new Array(count, "unused"));
GetMapFrame().SetPropertyPaneToolbarVisibility(true);
}
code = '
' + text + '
';
}
else
{
code = '
 __#PROPERTIESNAME#__   __#PROPERTIESVALUE#__';
for(var i=0; i < properties.length; i++)
code += '
 ' + properties[i].name + '' + 
HtmlDecode(properties[i].value) + '';
code += '
';
GetMapFrame().SetPropertyPaneToolbarVisibility(true);
}

SetContent(code);
}

.

var _el = null; //Our "parser" element

function HtmlDecode(input)
{
if (input == null || input == "")
return input;

if (_el == null)
_el = document.createElement('div');

_el.innerHTML = input;
return _el.childNodes[0].nodeValue;
}




--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306550.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-06 Thread gom
Thanks for those links.  I have read them.  As you can see from my post, my
problem is with the Ajax viewer, not the Fusion viewer.



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306516.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users

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

2017-02-03 Thread RenoSun
I think these links will help you :)
enable-hyperlink-in-selection-panel-of-fusion-viewer

  

SQL - html display problem in properties pane

  



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Ajax-viewer-URL-in-Properties-Pane-tp5306236p5306272.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
___
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users