HTML in selection results?

4 messages Options
Embed this post
Permalink
Jason Birch

HTML in selection results?

Reply Threaded More More options
Print post
Permalink
Hi all,

I'd really like to be able to define some calculated columns in a
MapGuide FeatureSource like so:

<Extension>
 <Name>Assessment_Hyperlinked</Name>
 <FeatureClass>Default:AssessmentParcels</FeatureClass>
 <CalculatedProperty>
  <Name>PropertyReport</Name>
  <Expression>concat('<a
href="http://citymap.nanaimo.ca/civicreportdetails.cfm?GISLINK=',concat(
"GISLINK",'" target="_new">Launch Report</a>')))</Expression>
 </CalculatedProperty>
</Extension>

(this creates a "column" called PropertyReport that contains an HTML
link to the property report concatenated with the property identifier)

and then have these show up as HTML in the attribute list when you
select a feature.  I also see a case where I would want to have a
thumbnail image show up in the selection results.  Currently, defining
the columns works just fine, but the Fusion selection widget
html-encodes the data so it shows up as HTML source in the browser.

I can see why the results are html encoded (because valid user data
sometimes contains HTML entities), so I don't think that there is a
simple solution to this.

Ideally, portions of the string that look like /<a href[^>]+/ and /<img
src^>]+/ would be excluded from the html encoding...

Can anyone think of a solution?

Thanks,
Jason
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Jason Birch

RE: HTML in selection results?

Reply Threaded More More options
Print post
Permalink
> Ideally, portions of the string that look like /<a href[^>]+/
> and /<img src^>]+/ would be excluded from the html encoding...

OK, so I screwed up the regex... I think you get the idea :)
_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Paul Spencer-2

Re: HTML in selection results?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Jason Birch
Suggestion:

alter table properties add column PropertyReport;
update properties set PropertyReport = ...

ok, more seriously ... I think this will be something that has to be  
left to the new selection rendering code that Alan was working on -  
you can plug in your own JS function to render a selection.

What would be more useful in my mind would be a way to access the  
Extension contents when rendering so that you can have calculated  
properties be created in your own code on the client side.

Trying to do more stuff like this on the server with MapGuide is just  
going to get hairy (juggling types of fields, handling exceptions etc)  
and means more stuff in PHP that needs to be ported to the other  
languages if that ever gets done.

At least, that's what I think :)

Cheers

Paul

On 14-Aug-08, at 6:54 PM, Jason Birch wrote:

> Hi all,
>
> I'd really like to be able to define some calculated columns in a
> MapGuide FeatureSource like so:
>
> <Extension>
> <Name>Assessment_Hyperlinked</Name>
> <FeatureClass>Default:AssessmentParcels</FeatureClass>
> <CalculatedProperty>
>  <Name>PropertyReport</Name>
>  <Expression>concat('<a
> href="http://citymap.nanaimo.ca/civicreportdetails.cfm?GISLINK=',concat(
> "GISLINK",'" target="_new">Launch Report</a>')))</Expression>
> </CalculatedProperty>
> </Extension>
>
> (this creates a "column" called PropertyReport that contains an HTML
> link to the property report concatenated with the property identifier)
>
> and then have these show up as HTML in the attribute list when you
> select a feature.  I also see a case where I would want to have a
> thumbnail image show up in the selection results.  Currently, defining
> the columns works just fine, but the Fusion selection widget
> html-encodes the data so it shows up as HTML source in the browser.
>
> I can see why the results are html encoded (because valid user data
> sometimes contains HTML entities), so I don't think that there is a
> simple solution to this.
>
> Ideally, portions of the string that look like /<a href[^>]+/ and /
> <img
> src^>]+/ would be excluded from the html encoding...
>
> Can anyone think of a solution?
>
> Thanks,
> Jason
> _______________________________________________
> fusion-users mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/fusion-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://www.dmsolutions.ca/

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users
Jason Birch

RE: HTML in selection results?

Reply Threaded More More options
Print post
Permalink
Paul wrote:

> alter table properties add column PropertyReport;
> update properties set PropertyReport = ...

Heh.

To Fusion (or MapGuide for that matter), these calculated columns look
no different than a regular data source; it just creates a new feature
class that can be addressed instead of the default feature class.
Basically the same as Alter Table or Create View.  For clarity, I should
have just left that part out of my question :)

I can see a selection rendering plugin solving this problem though, as
long as it allows you to choose columns not to display.  For instance, I
might not want to show the property ID in the selection attribute list,
but use it to create links to the two reports.

Is there the equivalent of html_entity_decode in JavaScript?

I'm just glad that the maptips code allows me to include HTML... please
don't change this ;)

Jason

_______________________________________________
fusion-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fusion-users