Forums / Developer / Can we downgrade ezp3.5 JS popmenu to ezp 3.4 ?

Can we downgrade ezp3.5 JS popmenu to ezp 3.4 ?

Author Message

Lazaro Ferreira

Saturday 04 December 2004 4:32:17 am

Hi,

Has any body try to downgrade ezp3.5 JS popupmenu to ezp 3.4x ?

any hard issue there, beside the trivial copy of JS popmenu code ?

Lazaro
http://www.mzbusiness.com

Balazs Halasy

Saturday 04 December 2004 5:55:24 am

Lazaro,

The JS menu is tightly bound to some php scripts which are optimiezd to work with 3.5-stuff, like for example the hide-feature. If you port the JS menu then you'll also have to backport the php scripts. This may (or may not) be a challange depending on how familiar you're with the internals of the system.

Balazs

Lazaro Ferreira

Saturday 04 December 2004 6:51:54 am

Hi,

Balaz, We have researched the hide feature a bit, as far as we can see, we don´t need the hide feature in our popup menu.

We simply need the JS script ability to popup a menu ( showing children nodes without a server round ) when passing the mouse over an ezp standard HTML left menu item

Any other issue there ?

Lazaro
http://www.mzbusiness.com

Lazaro Ferreira

Thursday 09 December 2004 3:57:06 am

Hi,

Just to say that we have backported EZP JS Popmenu to EZP 3.4.x with success

Lazaro
http://www.mzbusiness.com

Paul Borgermans

Thursday 09 December 2004 4:56:14 am

Lazaro,

Can you contribute this, it is interesting for slow updaters who wil remain on 3.4 for a few months

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Frederik Holljen

Thursday 09 December 2004 8:06:33 am

AFAIK, you should be able to copy the JS code and use it without any modification. It doesn't use any ez publish functionality directly, it is just optimized for usage with eZ publish.

Lazaro Ferreira

Thursday 09 December 2004 10:06:22 am

Hi,

Paul, as Frederik said it can be used without code modifications, we follow EZP online doc to use it in EZP 3.4.

We have overrided the ezpublish template that link the JS popupmenu to ezpublish data, to implement a dinamic (database binded) JS popupmenu.

if you think it could be useful, we would post it as a contribution

Nevertheless there is an issue with JS popupmenu implementation for Mozilla , that we are going to report here

Lazaro
http://www.mzbusiness.com

Balazs Halasy

Friday 10 December 2004 4:31:23 am

Ah, sorry.. I thought you were talking about the treemenu, not the popupmenu itself.. of course, the popupmenu is totally independent of the rest and should be pretty much portable. The treemenu would (as I pointed out) require more effort.

Balazs

Frederik Holljen

Friday 10 December 2004 4:49:35 am

Lazaro,
Could you please post the issue as soon as possible so we can fix it for 3.5?

Frederik

Lazaro Ferreira

Friday 10 December 2004 8:23:37 am

Frederik,

The problem is that we have used Javascript event property onmouseover to attach ezpopmenu_showTopLevel routine (instead of registering in HTML event attribute onMouseover), we have done this way to keep code of both templates separate, this way we only add an include statement after ezp left menu tpl loop is finished

<script language="JavaScript1.2" type="text/javascript">
		aelement = document.getElementById( '{$anchor}{$cm.id}' );
		aelement.onmouseover = function() {literal}{ezpopmenu_showTopLevel( event, 'ChildrenMenu{/literal}{$cm.id}{literal}'); return false;}{/literal};
</script>

Calling ezpopmenu_showTopLevel from Mozilla produces the following error :

Error: event is not defined

no popupmenu is showed

IE does not report any error and shows the popupmenu

Lazaro
http://www.mzbusiness.com

Hans Melis

Friday 10 December 2004 8:29:33 am

Lazaro,

That error in Mozilla looks familiar to me. I think there's a call to window.event somewhere, which doesn't work in Mozilla. In Mozilla browsers, the event is passed as a parameter to the function.

function handleMouseEvent( e )
{
  if( !e )
  {
    var e = window.event;
  }
  ...
}

That should be the correct cross-browser code IIRC.

Hans
http://blog.hansmelis.be

Frederik Holljen

Friday 10 December 2004 8:45:06 am

Yep, this is most probably the reason. I didn't include this since all browsers include the event when calling the function from HTML. I'll take a look at this on monday. Thanks for reporting.

Frederik Holljen

Thursday 16 December 2004 6:57:45 am

Lazaro,

Could you please try to add

if( !event ) event = window.event;

at the beginning of the showToplevel and showSublevel methods? If it works I'll add it to 3.5.1.

Frederik

Lazaro Ferreira

Thursday 16 December 2004 10:14:13 am

Frederik,

Sorry!, at last popupmenu code was ok, was my problem registering a handler function without the event parameter, see the piece of JS code above, now the code works ok, because we have included the event parameter a function definition

<script language="JavaScript1.2" type="text/javascript">
		aelement = document.getElementById( '{$anchor}{$cm.id}' );
		aelement.onmouseover = function(e) {literal}{ezpopmenu_showTopLevel( e, 'ChildrenMenu{/literal}{$cm.id}{literal}'); return false;}{/literal};
</script>

On the other hand, AFAIK popupmenu functions only pass the event parameter to

ezjslib_mouseHandler( e )

function that in turn actually has the

if ( !e )
    {
        e = window.event;
    }


check for IE compatibility

I have tested and it is working ok for both Mozilla Firefox, and IE 6

Thanks!

Lazaro
http://www.mzbusiness.com

Frederik Holljen

Friday 17 December 2004 12:17:10 am

You are right. I should start reading my own code a bit more thoroughly :D