[OpenLayers-Users] Popup Class

Rodrigo rca.cirdan at gmail.com
Mon Nov 3 17:48:02 EST 2008


Hi everyone!!

I tried to test this script:

/*
 * Get the Ajax response and pop up a info bubble
 */
function setHTML(response) {
    if (response.responseText.indexOf('no results') == -1) {
        var cat="Unknown", src="Unknown", leg="Unknown", linkinfo="";
        var lines = response.responseText.split('\n');
        for (lcv = 0; lcv < (lines.length); lcv++) {
            var vals =
lines[lcv].replace(/^\s*/,'').replace(/\s*$/,'').replace(/ =
/,"=").replace(/'/g,'').split('=');
            if (vals[1] == "") {
                vals[1] = "Unknown";
            }
            if (vals[0].indexOf('CATEGORY') != -1 ) {
                cat = vals[1];
            } else if (vals[0].indexOf('SOURCE') != -1 ) {
                src = vals[1];
            } else if (vals[0].indexOf('LEGEND') != -1 ) {
                leg = vals[1];
            } else if (vals[0].indexOf('DATAITEM') != -1 ) {
                linkinfo = vals[1];
            }
        }
        var popup_info = "<font size=2><b>" + cat +
                        "<br>Description:</b> " + leg +
                        "<br><a href='" + linkinfo + "'
target='_blank'>More Info</a>" +
                        "<br><font size=1>Source: " + src +
                        "</font></font>";
        if (popup != null) {
            popup.destroy();
            popup = null;
        }
        popup = new OpenLayers.Popup.AnchoredBubble("SDVegetationInfo",
                                        mouseLoc,
                                        new OpenLayers.Size(250,120),
                                        popup_info,
                                        null,
                                        true);
        popup.setBackgroundColor("#bcd2ee");
//      popup.setOpacity(.7);
        map.addPopup(popup);
        popup.events.register("click", map, popupDestroy);
    }
}

It is defined here http://trac.openlayers.org/wiki/GetFeatureInfo, as
an example!

I'm using Geoserver 1.6.5 and I've got this error from my javascript debbuger:

Error: OpenLayers.Popup is undefined

Then, I tried to find it in openlayers.js that's inside Geoserver...
and there isn't
any kind of code that sounds a Popup class definition.

I'd really like to use some popups on my geoserver maps, using openlayers...

Does anyone knows something about this issue??

I apreciate any help =)

Thanks for now!

Rodrigo





======================================
Rodrigo C. Antonialli
Rio Claro - SP - Brasil
LinkedIn: http://www.linkedin.com/in/rcaprofile
Contato:  (19) 9757-0370
             rca.cirdan at gmail.com
             rcantonialli at gmail.com
             Skype: rc_antonialli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081103/0f4e727d/attachment.html


More information about the Users mailing list