<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Bob,<br>
<br>
Thanks for the info. I did a little experimenting and found out
that "a Service with a user input type pointing to a user extension
with a setValue function" will indeed work.<br>
<br>
So now I have a URL of <br>
<tt>geomoose.html?call=set_combobox&option_id=1</tt><br>
<br>
and a service of:<br>
<tt> <service name="set_combobox"><br>
<input type="ga_set_combobox" name="option_id"
value="0"/><br>
</service></tt><br>
<br>
with a user extension function of:<br>
<tt> GeoMOOSE.Services.InputType.SetComboBox =
OpenLayers.Class(GeoMOOSE.Services.InputType, {<br>
MAPBOOK_NAME: "ga_set_combobox",<br>
setValue: function(option_id) {<br>
// ---- TBD: Code to set combo box selection -----<br>
}<br>
});</tt><br>
<br>
The Chrome debugger says option_id = 1 so I think I'm good to go...<br>
<br>
I'm basking in the awesomeness of GeoMoose!<br>
<pre class="moz-signature" cols="72">Best Regards,
Brent Fraser</pre>
<br>
On 4/17/2012 3:56 PM, Bob Basques wrote:
<blockquote cite="mid:4F8DA0D0020000A80003556F@heckle" type="cite">
<p style="margin-top: 0; margin-bottom: 0"> <font face="Comic
Sans MS" size="3">Brent,</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Comic
Sans MS" size="3">It's not GeoMoose specific, but I did
something similar with this function I found via Google:</font>
</p>
<br>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> function gup( name )</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> {</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> name =
name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var regexS =
"[\\?&]"+name+"=([^&#]*)";</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var regex = new RegExp( regexS );</font>
</p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var results = regex.exec(
window.location.href );</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> if( results == null )</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> return "";</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> else</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> return results[1];</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> }</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> // Set center from request params</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var pminx = gup( 'minx' );</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var pminy = gup( 'miny' );</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var pmaxx = gup( 'maxx' );</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var pmaxy = gup( 'maxy' );</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var time_idx1=gup ( 'time_idx1' );</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> time_idx1 = time_idx1.replace(/%20/g, " ");</font>
</p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var time_idx2=gup ( 'time_idx2' );</font> </p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> time_idx2 = time_idx2.replace(/%20/g, " ");</font>
</p>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Courier"
size="3"> var veh_id=gup ( 'veh_id' );</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Comic
Sans MS" size="3">It works very similarly to PERL param
parsing. As you can see above, I have it set up to pass 7
different values that are optionally used to start up a page,
like so: </font><font color="#0000ff" face="Comic Sans MS"
size="3"><a moz-do-not-send="true"
href="http://pwultra5.ci.stpaul.mn.us/cp_tiles/OpenLayers/OL.AVL.report2.html?veh_id=2042&time_idx1=4/12/2012%206:00:00&time_idx2=4/13/2012%206:00:00"><i><u>http://pwultra5.ci.stpaul.mn.us/cp_tiles/OpenLayers/OL.AVL.report2.html?veh_id=2042&time_idx1=4/12/2012%206:00:00&time_idx2=4/13/2012%206:00:00</u></i></a></font>
</p>
<br>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Comic
Sans MS" size="3">This may get you closer to your goal.</font>
</p>
<br>
<p style="margin-top: 0; margin-bottom: 0"> <font face="Comic
Sans MS" size="3">bobb</font> </p>
<br>
<p style="margin-top: 0; margin-bottom: 0"> <br>
<br>
>>> Brent Fraser <a class="moz-txt-link-rfc2396E" href="mailto:bfraser@geoanalytic.com"><bfraser@geoanalytic.com></a> wrote:<br>
</p>
<table style="font-size: 1em; margin-bottom: 0; margin-top: 0;
margin-right: 0; margin-left: 15px" bgcolor="#f3f3f3" border="0">
<tbody>
<tr>
<td>
<div style="padding-left: 7px; border-left: solid 1px
#050505">
<p style="margin-top: 0; margin-bottom: 0"> Looks like I
have a need to set an initial condition for my
GeoMoose v2.4 site based on URL request values (these
URLs are presented in a Django-generated page from a
database query). <br>
<br>
There already are a couple of ways to set initial
values in GeoMoose:<br>
<br>
1. Specifying a Startup Service (<a
moz-do-not-send="true"
href="http://www.geomoose.org/howto/startup.html">http://www.geomoose.org/howto/startup.html</a>)<br>
</p>
<pre style="border-left-width: 1px; padding-bottom: 0; border-bottom-width: 1px; font-size: 14px; text-indent: 0px; font-family: Consolas, Deja Vu Sans Mono, Bitstream Vera Sans Mono, monospace; letter-spacing: normal; padding-right: 0; text-transform: none; background-color: rgb(248, 248, 248); text-align: left; border-right-width: 1px; border-top-width: 1px; font-weight: normal; padding-top: 0; padding-left: 0; font-style: normal; color: rgb(0, 0, 0); word-spacing: 0px; font-variant: normal; line-height: 17px"><p style="letter-spacing: normal; font-size: 14px; padding-right: 0; border-left-width: 1px; font-variant: normal; border-top-width: 1px; word-spacing: 0px; padding-bottom: 0; font-weight: normal; border-right-width: 1px; text-indent: 0px; font-family: Consolas, Deja Vu Sans Mono, Bitstream Vera Sans Mono, monospace; text-transform: none; margin-bottom: 0; color: rgb(0, 0, 0); text-align: left; padding-top: 0; line-height: 17px; padding-left: 0; font-style: n
ormal; margin-top: 0; border-bottom-width: 1px; white-space: pre; background-color: rgb(248, 248, 248)">
geomoose.html?call=set_image&fid</p>
<p style="margin-top: 0; margin-bottom: 0; white-space: pre">
=10&;image_id=20</p>
</pre>
<p style="margin-top: 0; margin-bottom: 0"> 2. Bookmarks
(hey, where's the Bookmark doc?)<br>
</p>
<pre style="border-left-width: 1px; padding-bottom: 0; border-bottom-width: 1px; font-size: 14px; text-indent: 0px; font-family: Consolas, Deja Vu Sans Mono, Bitstream Vera Sans Mono, monospace; letter-spacing: normal; padding-right: 0; text-transform: none; background-color: rgb(248, 248, 248); text-align: left; border-right-width: 1px; border-top-width: 1px; font-weight: normal; padding-top: 0; padding-left: 0; font-style: normal; color: rgb(0, 0, 0); word-spacing: 0px; font-variant: normal; line-height: 17px"><p style="letter-spacing: normal; font-size: 14px; padding-right: 0; border-left-width: 1px; font-variant: normal; border-top-width: 1px; word-spacing: 0px; padding-bottom: 0; font-weight: normal; border-right-width: 1px; text-indent: 0px; font-family: Consolas, Deja Vu Sans Mono, Bitstream Vera Sans Mono, monospace; text-transform: none; margin-bottom: 0; color: rgb(0, 0, 0); text-align: left; padding-top: 0; line-height: 17px; padding-left: 0; font-style: n
ormal; margin-top: 0; border-bottom-width: 1px; white-space: pre; background-color: rgb(248, 248, 248)">
geomoose.html?extent=-2530013,127825</p>
<p style="margin-top: 0; margin-bottom: 0; white-space: pre">
88,-202</p>
<p style="margin-top: 0; margin-bottom: 0; white-space: pre">
8586,13213082&on=Icebergs/all</p>
</pre>
<p style="margin-top: 0; margin-bottom: 0"> <br>
But instead of the above scenarios, I want to call a
JavaScript function (in my user extension) to
programmatically select an item in the ZoomTo combo
box, something like:<br>
</p>
<pre style="border-left-width: 1px; padding-bottom: 0; border-bottom-width: 1px; font-size: 14px; text-indent: 0px; font-family: Consolas, Deja Vu Sans Mono, Bitstream Vera Sans Mono, monospace; letter-spacing: normal; padding-right: 0; text-transform: none; background-color: rgb(248, 248, 248); text-align: left; border-right-width: 1px; border-top-width: 1px; font-weight: normal; padding-top: 0; padding-left: 0; font-style: normal; color: rgb(0, 0, 0); word-spacing: 0px; font-variant: normal; line-height: 17px"><p style="letter-spacing: normal; font-size: 14px; padding-right: 0; border-left-width: 1px; font-variant: normal; border-top-width: 1px; word-spacing: 0px; padding-bottom: 0; font-weight: normal; border-right-width: 1px; text-indent: 0px; font-family: Consolas, Deja Vu Sans Mono, Bitstream Vera Sans Mono, monospace; text-transform: none; margin-bottom: 0; color: rgb(0, 0, 0); text-align: left; padding-top: 0; line-height: 17px; padding-left: 0; font-style: n
ormal; margin-top: 0; border-bottom-width: 1px; white-space: pre; background-color: rgb(248, 248, 248)">
geomoose.html?UX_call=set_combobox&a mp;imag</p>
<p style="margin-top: 0; margin-bottom: 0; white-space: pre">
e_id=20</p>
</pre>
<p style="margin-top: 0; margin-bottom: 0">
Note that I keep the id in the value tag of the combo
box options:<br>
<span style="COLOR:"rgb(136, 18, 128)"
;FONT-FAMILY:"monospace"
;FONT-SIZE:"medium""><span
style="font-size: medium; text-indent: 0px;
white-space: pre-wrap; font-family: monospace;
letter-spacing: normal; text-transform: none;
text-align: -webkit-auto; font-weight: normal;
display: inline !important; font-style: normal;
float: none; color: rgb(136, 18, 128);
word-spacing: 0px; font-variant: normal;
line-height: normal"><option </span></span><span
style="FONT-FAMILY:"monospace"
;FONT-SIZE:"medium""><span
style="font-size: medium; text-indent: 0px;
white-space: pre-wrap; font-family: monospace;
letter-spacing: normal; text-transform: none;
text-align: -webkit-auto; font-weight: normal;
font-style: normal; word-spacing: 0px;
font-variant: normal; line-height: normal"
class="webkit-html-attribute-name">value</span></span><span
style="COLOR:"rgb(136, 18, 128)"
;FONT-FAMILY:"monospace"
;FONT-SIZE:"medium""><span
style="font-size: medium; text-indent: 0px;
white-space: pre-wrap; font-family: monospace;
letter-spacing: normal; text-transform: none;
text-align: -webkit-auto; font-weight: normal;
display: inline !important; font-style: normal;
float: none; color: rgb(136, 18, 128);
word-spacing: 0px; font-variant: normal;
line-height: normal">="</span></span><span
style="FONT-FAMILY:"monospace"
;FONT-SIZE:"medium""><span
style="font-size: medium; text-indent: 0px;
white-space: pre-wrap; font-family: monospace;
letter-spacing: normal; text-transform: none;
text-align: -webkit-auto; font-weight: normal;
font-style: normal; word-spacing: 0px;
font-variant: normal; line-height: normal"
class="webkit-html-attribute-value">10</span></span><span
style="COLOR:"rgb(136, 18, 128)"
;FONT-FAMILY:"monospace"
;FONT-SIZE:"medium""><span
style="font-size: medium; text-indent: 0px;
white-space: pre-wrap; font-family: monospace;
letter-spacing: normal; text-transform: none;
text-align: -webkit-auto; font-weight: normal;
display: inline !important; font-style: normal;
float: none; color: rgb(136, 18, 128);
word-spacing: 0px; font-variant: normal;
line-height: normal">"></span></span><br>
<br>
I'm thinking of adding some code to the end of
"onLoadedMapbook" to mimic the GeoMOOSE.startService
call:<br>
<br>
<tt> var args = OpenLayers.Util.getParameters();<br>
if(args.call) {<br>
GeoMOOSE.startService(args.call, args,
true);<br>
}</tt><br>
<br>
something like:<br>
<tt> var args = OpenLayers.Util.getParameters();<br>
if(args.UX_call) {<br>
eval(args.UX_call+'('+args+')');<br>
}</tt><br>
<br>
But perhaps a Service with a user input type pointing
to a user extension with a "setValue" function would
work with a startupService...<br>
<br>
Maybe I'm making this too difficult. Any advice?<br>
<br>
</p>
<pre class="moz-signature" cols="72"><p cols="72" style="margin-bottom: 0; margin-top: 0; white-space: pre" class="moz-signature">
-- </p>
<p style="margin-top: 0; margin-bottom: 0; white-space: pre">
Best Regards,</p>
<p style="margin-top: 0; margin-bottom: 0; white-space: pre">
Brent Fraser</p>
</pre>
</div>
</td>
</tr>
</tbody>
</table>
</blockquote>
</body>
</html>