Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » The new page is not highlighted in the left panel

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1502 Views
  • xmedeko
    Avatar
    Community Member
    94 Posts

    The new page is not highlighted in the left panel Link to this post

    Hi,
    do you have the same weird behaviour? When I create a new page and click on this page in the left panel, then this page is not highlighted, but appears correctly in the right panel. In the left panel, the home page is highlighted usually.

    I use FF 2.0 under Linux.

    cheers
    andy

  • Nathan Cox
    Avatar
    Community Member
    99 Posts

    Re: The new page is not highlighted in the left panel Link to this post

    Yeah, this behaviour's been bugging me for awhile, so I had a look at it. The problem is that the regular expression that that's used to get the ID of the item you're highlighting doesn't understand the IDs given to new pages before they're saved.

    A regular ID looks like "record-1" (which is the homepage), but a newly created page has an ID like "record-new-Page-0-1" which is the first - number 1 - new page in the page root (which has an ID of 0).

    What the regex does is take everything after the final "-" in the ID, which ends up with "1" for both the examples above, hence the problem.

    Now I'm no regex expert, so this probably isn't the best way but it seems to fix the problem if you go into /jsparty/tree/tree.js, and change about line 497 from

    if(this.id.match(/-([^-]+)$/)) return RegExp.$1;

    to

    if(this.id.match(/([^-]+)-(.+)$/)) return RegExp.$2;

    What this does is get everything after the FIRST "-" instead of the last one, so the homepage above will still return "1", but the new page will return "new-Page-0-1", which is what we want.

    Then again there might be a reason why it works like it does...

  • elijahlofgren
    Avatar
    Google Summer of Code Hacker
    222 Posts

    Re: The new page is not highlighted in the left panel Link to this post

    Andy: Thanks for reporting this.

    Nathan: Thanks for fixing this! You also fixed a Usability Issue and saved me some work.

    I've applied your fix to the gsoc branch of jsparty:
    ------------------------------------------------------------------------
    r37735 | elofgren | 2007-07-03 16:33:15 -0500 (Tue, 03 Jul 2007) | 5 lines

    BUGFIX: Fix bug 'The new page is not highlighted in the left panel'
    Reported and fixed here: http://www.silverstripe.com/bugs/flat/1895
    Thanks xmedeko and nathancox!
    Also fixes usability issue #26: http://www.elijahlofgren.com/silverstripe/use-bold-highlighting-when-creating-new-pages/

    ------------------------------------------------------------------------

    Thanks again,

    Elijah

  • Tim
    Avatar
    Core Development Team
    201 Posts

    Re: The new page is not highlighted in the left panel Link to this post

    Thanks for looking into this, this has been bugging me for some time as well

  • Tim
    Avatar
    Core Development Team
    201 Posts

    Re: The new page is not highlighted in the left panel Link to this post

    Another bug which may (or may not) be related to this;

    If you click go to add a page, and try and add say 15 pages in quick succession (by pressing the go button every second or so), the 'parent' page seems to be randomly selected as the new pages gets placed in a number folders, seemingly at random.

  • xmedeko
    Avatar
    Community Member
    94 Posts

    Re: The new page is not highlighted in the left panel Link to this post

    Nathan: thanks very much.

    Did somebody examine the other similar regexps in the tree.js? (lines 69, 220). Should they be changed as well?

  • Nathan Cox
    Avatar
    Community Member
    99 Posts

    Re: The new page is not highlighted in the left panel Link to this post

    I haven't noticed any problems that those other regexes could be causing, but then again I just don't want to go back into the JavaScript.
    Complex JavaScript like this is what makes me lock my doors at night, so I might stick to the PHP

    1502 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.