sfEasyGMapPlugin won't show the Google Map - plugins

I've just started to use the sfEasyGMapPlugin, in my Symfony website. So I've followed the samples and created a basic map, to check if it works.
In the action :
$this->gMap = new GMap();
$this->gMap->setCenter(50.637551,3.062725);
And in the template :
<?php use_helper('Javascript','GMap') ?>
<?php include_map($gMap,array('width'=>'700px','height'=>'400px')); ?>
<!-- Javascript included at the bottom of the page -->
<?php include_map_javascript($gMap); ?>
I've signed up some api keys for my domains like http://localhost or http://127.0.0.1 and defined them in my app.yml.
Now, when I go to the page, the canvas shows up with it's control buttons, but the map do not shows up (there is only a grey background).
There is no error, everything seems to be configured fine. I can center the map on a point, like in the action above, but it do nothing.
I've tried to use the html code given by Google with my api keys and it works fine. So I really don't understand.
Am I doing it wrong ?
Regards,
Timothée Martin.

I got my answer...
You must define the center AND the zoom level with :
$this->gMap->setCenter(latitude, longitude);
$this->gMap->setZoom(level);
After that, the map shows up normally.
Hope it helps...

Related

What's the "right" way to add Google Web Auth to Svelte/Sapper?

Giving Svelte/Sapper a look and am curious what the right way to add something like Google Sign-In for Websites to my app.
I have everything working from the example code they give you from the site above, but I've done it by adding the onsuccess "onSignIn" function to the template.html file which doesn't seem like the right way to do this.
Inside src/routes/template.html
<script src="https://apis.google.com/js/platform.js" async defer></script>
<script>
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
console.log("ID: " + profile.getId());
}
</script>
Inside src/components/Nav.svelte
<div class="g-signin2" data-onsuccess="onSignIn" data-theme="dark"></div>
The code above works fine because onSignIn has access to window, but it seems like I should be able to add this to the Nav component where the button itself lives. Is there a preferred way to handle something like this?
If anyone is looking for something similar, I found this git repo that I was able to get started and modify to suit my needs github.com/beyonk-adventures/svelte-social-auth.

hello.js not in AngularJS web app not working on iPhones and Blackberry Z10s

I have a login system that works for most people (on Chrome, Android devices, IE8, Firefox, etc), but it seems not to work for people with Z10s or iPhone 5s. I don't have access to these devices so it's difficult to test, so I wanted to ask whether I was setting up everything properly.
It's an AngularJS app, using hello.js for OAuth, and bootstrap-social and font-awesome for the sign in buttons.
To insert hello into Angular, in app.js I include:
var app = angular
.module('myapp', [
'ui.bootstrap',
'ui.router',
'hello',
])
...
.run([..., 'hello', ..., function(..., hello, ...) {
...
hello.init(...);
...
}]);
...
var helloApp = angular.module('hello', []);
helloApp.factory('hello', function() {
return window.hello; // Assumes hello has been loaded
});
Then, in my loginCtrl, I inject it with
angular.module('myapp').controller('loginCtrl', [..., 'hello', ...,
function(..., hello, $location, ...) {
...
$scope.doLogin = function(network) {
console.log('Calling hello ' + network);
hello.login(network);
};
...
}]);
And in my view, I have
<button id="facebookLogin" class="btn btn-social btn-facebook" ng-click="doLogin('facebook')">
<span class="fa fa-facebook pull-left"></span> <span>Sign in with Facebook</span>
</button>
<button id="googleLogin" class="btn btn-social btn-google-plus" ng-click="doLogin('google')">
<span class="fa fa-google-plus pull-left"></span> <span>Sign in with Google</span>
</button>
Yesterday I was using onclick="hello.login('facebook')", and I suspected that was breaking on certain devices because I shouldn't be using onclick and hello wasn't in scope, so that's why I changed it to ngClick and calling a function in scope. The specific effect of onclick on the users who had errors was to redirect the user to the default/catch-all route without accessing the server at all (I listen for hello events and call the server, so this suggests it wasn't calling hello at all.)
But still, I ask the people who are having issues to re-try (after refreshing obviously), and now they say the button simply does nothing.
Other buttons on the site work. In fact, to get to this page, they use a <button> that uses ui-router to get to this page.
I'm going to continue to search, but I just wanted to ask if I seemed to be hooking hello.js into AngularJS properly, and not making any other beginner mistakes.
I believe the problem is that iPhones and Z10s were blocking hello.js's popup OAuth authentication, but I couldn't just switch it to use page.
When I tried, Facebook returns me to my redirect_url with the fragment
#access_token=....&expires_in=4264&state={%22client_id%22%3A%22164986300332415%22%2C%22network%22%3A%22facebook%22%2C%22display%22%3A%22page%22%2C%22callback%22%3A%22_hellojs_3ojn1yy8%22%2C%22state%22%3A%22%22%2C%22oauth_proxy%22%3A%22https%3A%2F%2Fauth-server.herokuapp.com%2Fproxy%22%2C%22scope%22%3A%22basic%22%2C%22oauth%22%3A{%22version%22%3A2%2C%22auth%22%3A%22https%3A%2F%2Fwww.facebook.com%2Fdialog%2Foauth%2F%22}}
it's ugly, but the point is it starts with a hash tag. So, while hello.js can normally read this, it couldn't in this case because Angular would mangle the address immediately. I'm not sure if this is because I specify to use hash-bangs instead of hash's, but it was.
And I couldn't send this to a PHP script or anything because the fragment after the hashtag would never make it to the PHP script.
So, my solution was to point the redirect_url at an independent page that has hello.js on it, but no Angular. It saves stuff to window.sessionStorage and redirects the user back to the login page, where hello.js passes the user through.
I'm not very confident in this ugly approach yet, so I put a browser sniffer to only do it for iPhones (and use popup for everyone else), I may remove this check in the future (because it's sketchy)
#matt it uses localstorage, not sessionstorage.
Use popup for all, and define a redirect_uri page with just hello.js In it. I dont know why you might think thats sounds wrong. All the demos do it this way. It also gives you a chance to display a nifty loading screen.
Sorry about the ugly fragment. It communcates a lot of state parameters which is used for the oauth proxy... most endpoints like facebook dont need it, so I might refactor that to make it a little less daunting.

Zend framework redirector doesn't work properly

I'm trying to develop a site using Zend Framework, but i have a problem:
I have the default controller which shows me a page with a link. That link uses another controller and redirects me to a start page from that controller (i have implemented startAction() in my custom controller, and the start.phtml page in the modules/default/view/scripts/disc directory).The start view contains a table which is populated from a database, and three link: Add, Edit and Delete. For the Add link i use in start.phtml the following code:
<p>Add</p>
And for the other two link something like that except the action name. First time when i use one of the links, everything works fine, but when it returns me to the start page all the links don't work anymore. They just keep me in the start page. In my addAction() i do the things i need, and at the end i use the following code to return to start page :
$this->_helper->redirector ( 'start' );
and when the start page is loaded again the 'Add' link points to the start page and not anymore to the Add page. The same thing happens with the other two links.
Can anyone help me, please ?
you are attempting to use the short hand version of the action helper Redirector()
$this->_helper->redirector ( 'start' );
To avoid confusion with the utility method version (and because I don't know what the exact defaults are) I always use the proper form.
//the redirector helper has to many options to comfortably short hand.
//gotoSimple(), gotoUrl() and gotoRoute() are all easy to use.
$this->_helper->getHelper('Redirector')->gotoSimple('action' => 'start', 'controller' => 'index')
to use the utility method _redirect(), try something like this (it acepts a url):
$this->_redirect('/index/start');
I think that start must be its own route. As a result, you need to specify the default route when using the url view helper:
In start.phtml, try this:
<p><a href="<?php echo $this->url(
array ('controller' => 'disc','action' => 'add'), 'default');
?>">Add</a></p>

IE and Facebook signed request

For some odd reason, i do not receive a "signed_request" when using IE. If i use the same application in firefox/chrome i get the signed request! has anyone had this problem and is there a solution.
I tried to search it up, but i can never get anything close to what i am asking (signed_request usually just takes over search and i get a bunch of documentation on how to parse it).
So i decided, well this is strange!
<?php print_r($_POST) // or request ?>
I made this as a page. In FF and Chrome, both give me the post information, but IE does not give me anything... just
Array( )
Thanks!
signed request is the included for case where user access your content via facebook. That should be signed to the server... and therefore it should not depends on the client browser. check you code to see if you have done something like redirecting the request when the session / user is invalid.
A solution that worked for me was to put this header in my tab page:
<?php
header('P3P: CP="CAO PSA OUR"');
header('P3P: CP="HONK"');
?>
I've found this solution here: http://hasin.me/2011/09/30/story-about-blue-e-iframed-web-application-wastage-of-6-hours-and/

How would you add a step in the AccountController of Magento?

I need to add a tracking code to a Magento template, pretty simple, but I need it on the confirmation page when a user register, but when it does, he's redirected to the index page, as any user who log in.
I think to add a step by override the account controller because there no such configuration (or I wasn't able to find it), but even if it's just a method override of confirmAction to handle the redirect, it doesn't look like the best way, because this redirect is called several time depending on several things and add session message.
Any ideas?
The only real way I know that you could do this would be to hook into the controller_action_postdispatch_customer_account_createPost event. If you don't know how to do that, check out this Wiki page.
In your observer, do something like this:
// Store a simple boolean that flags this user as just having registered
Mage::getSingleton('core/session')->setUserJustRegistered(true);
Then, in any footer template, do something like this:
<?php if (Mage::getSingleton('core/session')->getUserJustRegistered()): ?>
<!-- INSERT TRACKING CODE HERE -->
<?php Mage::getSingleton('core/session')->setUserJustRegistered(null); ?>
<?php endif; ?>
Note that we reset our session variable back to null so that your tracking code doesn't end up firing on every page.