henrichen / zkgmapsz

Automatically exported from code.google.com/p/zkgmapsz
0 stars 0 forks source link

Support 'client' attribute #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
'client' attribute is enterprise key in Google Maps API v3, need to add an 
attribute so user can specify enterprise key like other attributes (e.g., 
sensor, language) as needed see 
https://developers.google.com/maps/documentation/business/clientside/#MapsJS 
for more information

Original issue reported on code.google.com by benbai...@gmail.com on 15 Jul 2013 at 3:07

GoogleCodeExporter commented 9 years ago

Probably can override _tryBind as a workaround:

<zk xmlns:w="client">
    <gmaps width="500px" height="500px">
        <attribute w:name="_tryBind"><![CDATA[
            function(dt, skipper, after) {
                    var maskOpts;
                    if (maskOpts = this._maskOpts) {
                        if (maskOpts._mask && maskOpts._mask._opts) {
                                maskOpts._mask._opts.anchor = this;
                                maskOpts._mask.sync();
                        } else {
                                gmapsGapi.clearMask(this, maskOpts);
                                this._maskOpts = gmapsGapi.initMask(this, {message: 'Loading Google Maps APIs'});
                        }
                    }
                    if (!window.google || !window.google.maps) {
                        if (window.google && (!window.google.load  || window.google.loader.LoadFailure)) {
                            var n = jq(this.uuid, zk)[0];
                            n.innerHTML = gmaps.Gmaps.errormsg; 
                            return;  //failed to load the Google AJAX APIs
                        }
                        var wgt = this,
                                opts0 = {};
                        opts0['condition'] = function() {return window.google && window.google.maps;};
                        opts0['callback'] = function() {};

                        if (!opts0.condition()) {

                            gmapsGapi.waitUntil(wgt, opts0);
                            if (!gmaps.Gmaps.LOADING) { //avoid double loading Google Maps APIs
                                    gmaps.Gmaps.LOADING = true;
                                    if (!opts0.condition()) {
                                            var opts = ['sensor=',
                                                    this._sensor? this._sensor : 'false',
                                                    '&language=', this._language? this._language : '',
                                                    '®ion=', this._baseDomain? this._baseDomain : '',
                                                    '&libraries=', this._libraries? this._libraries : '',
/*  add your client id here >>>>>>>>>>>>>>>>>> 
*/  /*'&client=YOUR_CLIENT_ID'*/].join('');
                                        google.load('maps', this._version,
                                            {
                                                other_params: opts,
                                                callback: function(){// load marker manager after map api loaded
                                                    zk.loadScript(zk.ajaxURI('/web/js/gmaps/ext/markermanager.js', {desktop : this.desktop,au : true}));
                                                    wgt._realBind(dt, skipper, after);
                                                }
                                            }
                                        ); // load the maps api
                                    }
                            }
                        } else {
                            opts0['condition'] = function() {return window.MarkerManager;};
                            opts0['callback'] = function() {wgt._realBind(dt, skipper, after);};
                            gmapsGapi.waitUntil(wgt, opts0);
                        }
                    } else {
                        var wgt = this,
                                opts1 = [];
                        opts1['condition'] = function() {return window.MarkerManager;};
                        opts1['callback'] = function() {wgt._realBind(dt, skipper, after);};

                        gmapsGapi.waitUntil(wgt, opts1);
                    }
            }
        ]]></attribute>
    </gmaps>
</zk>

Original comment by benbai...@gmail.com on 15 Jul 2013 at 3:08

GoogleCodeExporter commented 9 years ago

Original comment by raymondchao@potix.com on 5 Dec 2013 at 9:31

GoogleCodeExporter commented 9 years ago
hi guys, please could you let me know which files i should change in my gmpas 
library in order to support the client ID.
thanks in advance

Original comment by rachidou...@gmail.com on 24 Oct 2014 at 2:53