[Chameleon] [UNCLASSIFIED] QuickZoom and SQLQuery
widget integration
Jason Fournier
jfournier at dmsolutions.ca
Sun Dec 4 23:20:48 EST 2005
Dale,
One quick way would be to generate the <select></select> content in your
index.phtml (initialization file) and output it to your template through
the use of [$|$].
So, in your index.phtml you would do something like:
$hLink = mysql_connect('mysql_host', 'mysql_user', 'mysql_password');
mysql_select_db('my_database');
$sql = 'SELECT * FROM my_table';
$result = mysql_query($sql);
$szOptions='';
while ( ($aRow = mysql_fetch_assoc( $result )) !== false )
{
//write out your <option></option> here
// something like:
// $szOptions .= '<option
value="'.$aRow['minx'].','.$aRow['miny'].';'.$aRow['maxx'].','.$aRow['maxy'].'|'.$aRow['epsg'].'">'.$aRow['something'].'</option>';
// follow this format:
// <option
value="-69.053,44.567;-63.778,48.065|epsg:4326">New Brunswick</option>
}
// now set your preprocess include for the template
// make sure to set it after you've initialized
$oApp->setVar( 'MYOPTIONS', $szOptions );
In your template you could do something like:
<select onchange="changeQuickZoom(this)"
name="NOT_QUICK_ZOOM">[$MYOPTIONS|<option>error</option>$]</select>
You would also have to include a QuickZoom widget in your template with
it's visibility set to false. You need to include this widget so that
the appropriate javascript and markup is included to make it all work.
I think NAV_QUICKZOOM and SEL_QUICKZOOM are required for parseURL and
changeQuickZoom(obj) is definitely needed.
disclaimer: untested code. Write back if you run into issues.
Best Regards,
Jason
Dale.Young at brs.gov.au wrote:
> Hi all,
>
> I have extent information for 100+ regions stored in a MySQL
> database and would like to implement it in something along the lines of
> the QuickZoom widget without of having to hard-code.
>
> I am a new user of Chameleon, and after reading the doco for Widget
> creation and the JSAPI am a little unsure as to the development path to
> take.
>
> Wondering if anyone might be able to advise?
>
> Regards
>
> Dale
>
> ----------------------------------------------------------------------
>
> IMPORTANT - This message has been issued by The Department of
> Agriculture, Fisheries and Forestry (DAFF). The information transmitted
> is for the use of the intended recipient only and may contain
> confidential and/or legally privileged material. It is your
> responsibility to check any attachments for viruses and defects before
> opening or sending them on.
>
> Any reproduction, publication, communication, re-transmission,
> disclosure, dissemination or other use of the information contained in
> this e-mail by persons or entities other than the intended recipient is
> prohibited. The taking of any action in reliance upon this information
> by persons or entities other than the intended recipient is prohibited.
> If you have received this e-mail in error please notify the sender and
> delete all copies of this transmission together with any attachments. If
> you have received this e-mail as part of a valid mailing list and no
> longer want to receive a message such as this one advise the sender by
> return e-mail accordingly. Only e-mail correspondence which includes
> this footer, has been authorised by DAFF
>
> ----------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
--
________________________
Jason Fournier
DM Solutions Group Inc.
jfournier at dmsolutions.ca
www.dmsolutions.ca
613.565.5056 x18
More information about the Chameleon
mailing list