SourceForge has been redesigned. Learn more.
Close

#10 Collapse/Expand JS: Missing nodes object (Devel 3.1.5)

closed
nobody
None
5
2004-08-13
2004-07-12
uncle_f
No

Hello and first of all thanks for a brilliant software!

I believe I found a small bug in the JavaScript code that
expands and collapses the tree branches, namely in the
layerstreemenu.ijs.

On the line 20 that goes like:

if (sonLayer.style.display == 'none') {

sometimes sonLayer is not defined. This results in error
displayed by browser (tested with IE 6), when the user
clicks on the tree node that does not have '+' or '-'
action on it, i.e. the connection node.

The easiest way to see this happening is to go to the
http://phplayersmenu.sourceforge.net/ and look at the
first tree starting with "Linus B. Torvalds". Click on the
line connecting the top item with the next one ("Linux
Kernel Archives") -- on the left of the icon -- and see an
error in the status bar.

This is easily fixed by enclosing the whole
"if (sonLayer.style.display == 'none') {" statement into
another if structre:

if (sonLayer) { .... }

Maybe it is not the absolutely right way to fix it, as it is
likely that the php tree-generating code could be
modified to produce "better" layers, but it works for me
anyway.

Discussion

  • Marco Pratesi

    Marco Pratesi - 2004-07-12

    Logged In: YES
    user_id=65709

    > Hello and first of all thanks for a brilliant software!

    :-)

    > see an error in the status bar.

    Errors are not shown in the status bar, they are shown
    in the JavaScript Console.

    The error reported by the JavaScript Console is:

    **************************************
    Error: sonLayer has no properties
    Source File: http://phplayersmenu.sourceforge.net/
    Line: 368
    **************************************

    Clicking on the error opens the "Source of:" window
    and evidences the following line of code:

    **************************************
    if (sonLayer.style.display == 'none') {
    **************************************

    > Maybe it is not the absolutely right way to fix it

    In fact, it is not.
    Clicking on that image should not trigger any action,
    the right fix is to eliminate the onmousedown="..."
    for images that do not correspond to any
    expandable/collapsable item: in fact,
    they do not have any "son".
    This fix would also significantly reduce the resulting
    HTML code size.

    Thank you for finding the bug, I would have never
    found it, as I always click only on [+] and [-],
    never elsewhere :-)

    I will fix this bug asap, very likely rather soon
    in the next release (that should be 3.2beta).

    Marco Pratesi

     
  • uncle_f

    uncle_f - 2004-07-12

    Logged In: YES
    user_id=1081943

    Thanks for a speedy reply!

    > Errors are not shown in the status bar, they are shown
    > in the JavaScript Console.

    Indeed, the errors are shown in the JavaScript console - that
    was a bit incorrect of me (but the link to access the console
    in IE could be displayed in the status bar anyway ;) )

    > Clicking on that image should not trigger any action,
    > the right fix is to eliminate the onmousedown="..."

    Yep, this is exactly what I meant by saying that tree-
    generating code could be modified to produce "better"
    HTML/CSS code. But for now I have to stick with an ugly
    workaround desribed above.

    > This fix would also significantly reduce the resulting
    > HTML code size.

    I can't wait to see the fix exactly for this reason!
    I have some huge trees here, accounting for 300+ items. I
    believe that should improve the loading speed quite a bit!

    Thanks again!

     
  • Marco Pratesi

    Marco Pratesi - 2004-07-27

    Logged In: YES
    user_id=65709

    > Indeed, the errors are shown in the JavaScript console - that
    > was a bit incorrect of me (but the link to access the console
    > in IE could be displayed in the status bar anyway ;) )

    Analyzing errors through msie is just a pain, it's almost as
    solving a riddle...
    ... such problems, unless msie-specific[*][**], should be
    analized
    with a serious tool, such as the Mozilla JavaScript Console
    (preferring recent Mozilla versions, that allow to immediately
    evidence the affected line of code, just with a simple click).

    [*] in this case, it's not unlikely that it's a msie bug and
    not a phplm bug >:-)

    [**] please also consider that I need to reproduce the bug
    and you should be interested in seeing the bug reproduced
    soon ;-)
    msie runs only on the mswindows environment, whereas Mozilla
    runs virtually on whatever platform.

    Marco Pratesi

     
  • Marco Pratesi

    Marco Pratesi - 2004-07-27
    • labels: 353191 -->
     
  • Marco Pratesi

    Marco Pratesi - 2004-07-27

    Logged In: YES
    user_id=65709

    This bug is fixed in version 3.2beta, released just today.

    Please check if the fix is OK for you.

    I will close this bug report soon; now I leave it open because,
    if I find time, I want to backport this fix on the 3.0
    branch and
    to release a fixed 3.0.2 version.

    Marco Pratesi

     
  • uncle_f

    uncle_f - 2004-07-29

    Logged In: YES
    user_id=1081943

    Just to confirm -- the bug is gone now.
    Thanks for your work!

     
  • Marco Pratesi

    Marco Pratesi - 2004-08-13

    Logged In: YES
    user_id=65709

    I have released just now version 3.0.2,
    that fixes this bug also on the current stable branch,
    hence I am finally closing this bug report.

    Marco Pratesi

     
  • Marco Pratesi

    Marco Pratesi - 2004-08-13
    • status: open --> closed
     

Log in to post a comment.