[Geomoose-users] Select Info to a new window - A solution and a tip

Brent Fraser bfraser at geoanalytic.com
Mon Jun 22 12:49:08 EDT 2009


To All,

  One very serious limitation to the solution below is that highlighting the selected features will no longer work.  The stock select.php's output options (xml, html) write out xml to populate the GM's "highlight" layer definition (just before the nicely formated html); something like:

<html xmlns:moose="http://geomoose.org/"><head>
<moose:mapbook>
<moose:map title='Highlight' default='true'>
	<moose:file>select.map</moose:file>	
	<moose:param name='layers' value='Wells'/>	
	<moose:param name='qlayer' value='Wells'/>
	<moose:param name='mapshape' value='-12586577.1509 7124590.67017 -12586061.8759 7124590.67017 -12586061.8759 7124111.68214 -12586577.1509 7124111.68214 -12586577.1509 7124590.67017 '/>
	<moose:selected id='100062105721W400'/>
	<moose:selected id='102062105721W400'/>
</moose:map>
</moose:mapbook>
</head><body><![CDATA[<table>
<tbody>
<tr>
  :
  :

So writing it to a new window (or not writing it at all via "bare-html" below), will cause the features not to be highlighted.

I'm not sure what the solution is; have the callService function somehow read the XML delivered to the new window?  Or have some Javascript in the new window call a function in GM to set the highlight info?


And by the way, it seems my formating problem was the 
    print "<![CDATA[";
and 
    print "]]>";

surrounding the print $template;  Commenting those out restored the formating and didn't seem to break the highlighting.
So that leaves the XML problem...

Brent Fraser


Brent Fraser wrote:
> To all,
> 
> A solution:
> -----------
>   Following Dan's suggestion I edited the select.php to include:
> 
> } elseif($output == 'bare-html') {
> 	header('Content-type: text/html');
> 	print "<head>\n";
> 	print "</head>";
> 	print "<body>";
> 	print $template;
> 	print "</body>";
> 	print "</html>";
> 
> and added display="window" to my "select Feature" service attributes in my application's xml config file:
>         <service title="Select Feature" default="true" display="window" 
> as well as changing the output type:
>             <input type="hidden" name="output" value="bare-html"/>
> 
> And a tip:
> ----------
>  To get the results sent to the same window on each select operation (instead of separate windows being created each time), I added target="MySelection" to the service attributes:
>         <service title="Select Feature" default="true" display="window" target="MySelection"
> 
>  The value can be anything, it just needs to be a named target.
> 
> Brent Fraser
> 
> Brent Fraser wrote:
>> I had a look at the HTML generated by the SELECT service (not the IDENTIFY):
>>
>> <html xmlns:moose="http://geomoose.org/"><head>
>> <moose:mapbook>
>> <moose:map title='Highlight' default='true'>
>> 	<moose:file>../../TopoCan/select.map</moose:file>	<moose:param name='layers' value='Wells'/>	<moose:param name='qlayer' 
>> 	:
>> 	:
>>
>> It doesn't render very well when sent to a new window (using the display="window" tag in the Select service.)
>>
>> Any thoughts on how to fix this?
>>
>> Thanks!
>> Brent
>>
>>
>> Brent Fraser wrote:
>>> Brian,
>>>
>>>   I just found the display tag while sifting thru ServiceManager.js  It seems to work ok for Identify, but for Select it opens a new window and prints the value of the map tag, e.g:
>>>
>>> ./select.map
>>>
>>> strange...
>>>
>>> Many Thanks!
>>> Brent
>>>
>>> Brian Fischer wrote:
>>>> Brent,
>>>> This use to work, but haven't tried it in a while.  You could set the display attribute of the service tag to display="window" and it would pop the results up in a new window.  Give that a try.  Here is the documentation we wrote on it:
>>>> http://www.geomoose.org/moose/index.php?option=com_content&task=view&id=14&Itemid=29 Look at the display attribute under <service> section.
>>>>
>>>> Also I had Dan write a little custom feature for me to create a link to open the results tab up in a new window so users could print it.  I think he mainly did it with some JavaScript and CSS.  Here is the app that is doing that. http://klamathcount
> y
>> .
>>> houstoneng.com/klamathmap/klamathmap.html Select some parcels with the mailing labels tool or Identify tool then click on the "Print Info. Tab" in the menubar.
>>>> Hope this helps,
>>>> Brian
>>>>
>>>> Brian Fischer, CFM  GIS Project Manager
>>>> Houston Engineering, Inc.
>>>> Phone: W: 763.493.4522 / M: 763.229.2734
>>>>
>>>> -----Original Message-----
>>>> From: Brent Fraser [mailto:bfraser at geoanalytic.com] 
>>>> Sent: Thursday, May 28, 2009 11:36 AM
>>>> To: Dan Little
>>>> Cc: GeoMOOSE Users List
>>>> Subject: Re: [Geomoose-users] Info from Select to a new window?
>>>>
>>>> Dan,
>>>>
>>>>  I'm using V1.6.1.  
>>>>
>>>> It looks like the target of the html/text generated by select.php is set around line 488 in ServiceManager.js (of course I could be totally out-to-lunch as my JavaScript is weak):
>>>>
>>>> 	} else if(returnType.match(/text/i) || contentType.match(/plain/i)){ // Plain Text Return
>>>> 		var results = document.getElementById('content_results_form');
>>>> 		var text = http.responseText;
>>>> 		if(!(text.match(/\<html/))) {
>>>> 			text = text.replace(/\n/g,'<br/>\n');
>>>> 			text = '<tt>'+text+'</tt>';
>>>> 		}
>>>> 		results.innerHTML = text;
>>>> 		EventManager.triggerEvent('changetab',TABS_RESULTS_NAME);
>>>> 	} else if(returnType.match(/csv/i) || contentType.match(/csv/i)) { // CSV return type
>>>>
>>>>
>>>> perhaps if do something like:
>>>> 		var win = window.open("", "Results", "width=100, height=100, scrollbars=yes" );
>>>> 		var results2 = win.document.body;
>>>> 		results2.innerHTML = text;
>>>>
>>>> Any thoughts on that?
>>>>
>>>>
>>>> Thanks!
>>>> Brent
>>>>
>>>> Dan Little wrote:
>>>>> 1.6 or 2.0?
>>>>>
>>>>>
>>>>>
>>>>> ----- Original Message ----
>>>>>> From: Brent Fraser <bfraser at geoanalytic.com>
>>>>>> To: GeoMOOSE Users List <geomoose-users at lists.sourceforge.net>
>>>>>> Sent: Wednesday, May 27, 2009 11:35:08 AM
>>>>>> Subject: [Geomoose-users] Info from Select to a new window?
>>>>>>
>>>>>> I'd like to send the attribute information of my selected features to a new 
>>>>>> browser window instead of the Information tab.  What's a good way to do this?
>>>>>>
>>>>>> Thanks!
>>>>>> Brent Fraser




More information about the Geomoose-users mailing list