phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

little problem after upgrading php to ver 5.3.27 from 5.3.13

Goto page Previous  1, 2
 
Search this topic... | Search phpBB2 Discussion... | Search Box
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Author Message
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 8:22 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Salvatos wrote:
Interesting puzzle. I'd like to compare the HTML sources for your phoogle_map.php and any of the pages where the map doesn't work, please.

I have tried also in Firefox and I get this ERROR in the registration page:

TypeError: target.apply is not a function

Line: target.apply(document.getElementById("phoogleTarget"));

and it is the same error which IE warns about in my earlier post...
I think that is the error key which prevents the map to show up as I don't get it in the phoogle_map.php page
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 8:34 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

In the next days I will try to make a clone copy of the forum over a test domain so that I can show better the problem on a live environment.
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 8:48 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

A progress in debugging the error......

if you open the file phpbb_google_class.php (attached to 1st post)
from line 202 there is the piece of code interested in the browser error:

Code:
// This little bit controls whether the target image is shown depending ======================
// on whether there is a div named phoogleTarget on the page or not ==========================
    if(document.getElementById('phoogleTarget') != null)
   {
      var target = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(".(round($this->mapWidth/2 - 7)).",".(round($this->mapHeight/2 - 7))."));
      target.apply(document.getElementById(\"phoogleTarget\"));
      map.getContainer().appendChild(document.getElementById(\"phoogleTarget\"));
   }
// ========================================================================================\n";   


I have just tried to delete this whole part from the file:

Code:
    if(document.getElementById('phoogleTarget') != null)
   {
      var target = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(".(round($this->mapWidth/2 - 7)).",".(round($this->mapHeight/2 - 7))."));
      target.apply(document.getElementById(\"phoogleTarget\"));
      map.getContainer().appendChild(document.getElementById(\"phoogleTarget\"));
   }


and the map now shows up!

Image link

but it works even if i just delete the line " target.apply(document.getElementById(\"phoogleTarget\"));"
and in this case it makes the red blinking target to disappear and the mod to functon correctly without that target.

indeed, there's something wrong in that piece of code... and that target is involved
I wonder what has been changed from php version 5.3.13 to break that part?
or maybe they have changed something in google maps core recently which broke the function of that centered target...

Do you have any idea?
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 415
Location: Québec


flag
PostPosted: Mon Dec 16, 2013 9:18 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

That code is JavaScript, not PHP... I don't see how a PHP update could have any effect on it.

I don't really understand the apply() method, but I don't think it's suppsoed to be called like that. You're supposed to apply() or call() a function, and pass it an object and arguments (individually with call() or in an array with apply()). What this code seems to do is apply() what I think is an object and pass it a single argument. Which is why IE and FF complain about target not being a function.

Here's an example I've found on a couple websites:
Code:
function sayColor(sPrefix, sSuffix) {

    alert(sPrefix + this.color + sSuffix);

};

var obj = new Object();
obj.color = “red”;

//outputs “The color is red, a very nice color indeed. “

sayColor.call(obj, “The color is “, “, a very nice color indeed. “);


I'm not really sure what to do with Phoogle to fix it. It looks like you'd have to do something like
Code:
GControlPosition.call(target, document.getElementById(\"phoogleTarget\"));

With target being some sort of object, but my understanding of JS doesn't go that far, and not having the code for GControlPosition doesn't help icon_neutral.gif
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 9:30 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Thanks for your effort!
I think I will just live without that line --> target.apply(document.getElementById(\"phoogleTarget\"));
and so without the target symbol anymore.

the purpose of that was just to put that red target in the centre of the map to help the user to position better the city or town over it... while moving the map with the mouse.

I have tried to put your line instead of the one above, but it doesn't help as the target is not showing.

I don't know how could be possible to break that thing, but the only thing I did was really the php upgrade with easy_apache!
probably that "target.apply" goes now in conflict with a function or something out of our knowledge, maybe developed by google recently... icon_eek.gif
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 415
Location: Québec


flag
PostPosted: Mon Dec 16, 2013 9:32 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Given that I am most likely wrong about how apply() should or shouldn't work since the old Google examples give the exact same format, the likely reason it broke would be that GControlPosition no longer exists in the v3 API. So if it's no longer defined anywhere, your object is probably broken. If you just remove that line, the target icon is just a div with a picture, so it doesn't break anything but doesn't do anything either.

Their migration guide has a section on Custom Controls that mentions changes to achieve a GControlPosition-like behavior, but to make it work, I reckon you're looking at a full transition of your mod to the v3 API.
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 415
Location: Québec


flag
PostPosted: Mon Dec 16, 2013 9:38 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

dondino wrote:
the purpose of that was just to put that red target in the centre of the map to help the user to position better the city or town over it... while moving the map with the mouse.

Oh, it didn't actually do anything? Then you could probably position the target div with JS and CSS by getting the phoogleMap div's position and calculating the target's div's position from that. However I think that would prevent moving the map if you click and drag on the target itself (which may have been the case already?) since it would be on a layer above the map - so I'm guessing you'd have a 14x14 px space in the middle of the map that "doesn't work".
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 9:49 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Yes, I think I would just need to put a red transparent target or a circle in the middle of the map... but I don't have a clue on how to do it, since it probably needs to be compatible with the new google api v3 functions

as dogs_and_things wrote, the "GControlPosition" variable is not present anymore, and that's what broke it, probably they stopped to support it completely days or weeks ago...anyway recently.

I have the fear that sooner or later even the map will not show anymore icon_biggrin.gif

Anyway... I have found THIS page,
especially its interesting the final piece of code in which makes an example to create a div element and insert it in google maps (v3)

Code:

/* V2 */

/* we used to create the custom control like */

SaveMapsStatus.prototype = new GControl();
       
SaveMapsStatus.prototype.initialize = function(map) {
        var container = document.createElement("div");
        container.id = ‘myId’;
        container.innerHTML = ‘<a href="save.php" ><img src="icon_save.gif" /></a>’;
        map.getContainer().appendChild(container);
        return container;
}
SaveMapsStatus.prototype.getDefaultPosition = function() {
        return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(80, 7));
}

map.addControl(new SaveMapsStatus()); /* we used to add to the map, after it was created */

/* v3 */
var container = document.createElement("div"); /* To change look, just add some style like container.style.border=” */
container.id = ‘myId’;
container.innerHTML = ‘<a href="save.php" ><img src="icon_save.gif" /></a>’; /* Custom HTML code */
map.controls[google.maps.ControlPosition.TOP_LEFT].push(container);


But even with the example above I have no clue on what I may try to correct or change in those 4 lines of javascript code involved...
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 415
Location: Québec


flag
PostPosted: Mon Dec 16, 2013 9:58 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

I would try this first.

FIND
Code:
      var target = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(".(round($this->mapWidth/2 - 7)).",".(round($this->mapHeight/2 - 7))."));
      target.apply(document.getElementById(\"phoogleTarget\"));
      map.getContainer().appendChild(document.getElementById(\"phoogleTarget\"));


REPLACE WITH
Code:
      document.getElementById(\"phoogleTarget\").style.margin-left = '".(round($this->mapWidth/2 - 7))."px';
      document.getElementById(\"phoogleTarget\").style.margin-bottom = '".(round($this->mapHeight/2 - 7))."px';


FIND (in all concerned .tpl files)
Code:
         <div id="phoogleMap"></div>
         <div id="phoogleTarget"><img src="{TARGET_FOLDER}target.gif" width="14" height="14" /></div>      </td>


REPLACE WITH
Code:
         <div id="phoogleMap"><div id="phoogleTarget"><img src="{TARGET_FOLDER}target.gif" width="14" height="14" /></div></div></td>


If I'm right, this will calculate padding on your target div (from inside the map div) to place it in the middle. But as I said above, I expect it will create a dead spot under the target.
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 10:13 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Salvatos,
here's what I get with your code-changes:

Image link

white map (not present?), and target is at center-top.... icon_rolleyes.gif
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 415
Location: Québec


flag
PostPosted: Mon Dec 16, 2013 10:36 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

Heh, that's weird. Then maybe you want to leave the .tpl as it was and use
Code:
map.getContainer().appendChild(document.getElementById(\"phoogleTarget\"));

as before, after
Code:
      document.getElementById(\"phoogleTarget\").style.margin-left = '".(round($this->mapWidth/2 - 7))."px';
      document.getElementById(\"phoogleTarget\").style.margin-bottom = '".(round($this->mapHeight/2 - 7))."px';


Though I'm not sure it would change anything.
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Mon Dec 16, 2013 11:05 pm 
Post subject: Re: little problem after upgrading php to ver 5.3.27 from 5.

it doesn't change much, it just brings the target to the bottom, but still no map there icon_smile.gif
don't struggle anymore with this

I leave it the easy-way, by deleting that part of code in php class, and no more target showing up.

The user location will be centered by "eye" and I will write a note beside that field icon_smile.gif
it's more important that the map shows up again...

I have tried hard with many different codes to try to show a cross in the middle of the map or a grid or something that would show a reference point for the centre...but I couldn't make it work :/
Back to top
Display posts from previous:   
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Page 2 of 2 All times are GMT
Goto page Previous  1, 2
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0212 seconds using 15 queries. (SQL 0.0015 Parse 0.0006 Other 0.0192)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo