[dokuwiki] Making index__tree open&close icons clickable links

  • From: Michael Bazzinotti <mbazzinotti@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 11 Jul 2012 04:55:56 -0400

The Goal: Have the open&close icons in the index__tree (sidebar) as
clickable links that operate the same as clicking the text-links.

here's a visual of what i am talking about:
http://s17.postimage.org/gjt3egjsv/Screen_shot_2012_07_11_at_4_07_40_AM.png


In browsing the code, I found several key spots of interest, including
html.php
   html_buildlist()
   html_list_index()
   html_li_index()

I am fully aware that the namespace tree html is being created with these
3. After only modifying these functions, the live update that used to occur
(Ajax?) to display the children does not happen at all. My guess is that it
might have to do with the changed tree-structure of the html tags. Since I
changed resulting html from

<li class="open/closed"><div class="li"><a
class="idx_dir"><strong>text</a></div></li>
to
<a class="idx_dir"><li class="open/closed"><div
class="li"><strong>text</strong></div></a>

Also, a couple namespace/pages get sort of duplicated in the tree. but the
duplicates arent clickable links. Please see the image to see what I mean.
http://s17.postimage.org/wtj9hcugr/Screen_shot_2012_07_11_at_4_06_17_AM.png
See how 'start' and 'targets' is duplicated in grey.

...

So I have rendered all entries in the tree useless. they dont update now!

The only other thing index__tree related I found was in media.js, line 52,
    var $link = $clicky.parent().find('div.li a.idx_dir');
I also tried setting it to
    'a.idx_dir li div.li' and
    'a.idx_dir'
none of that seemed to help.

Besides, it seems that 'media' related calls are different from "standard"
ones.

Anyways, I got the tree icons to become clickable links but it seems I
botched what the AJAX is looking for to make the correct update.

Also, I know it's ugly to have the whole div as a link (lots of whitespace
as a link). I plan on having 2 different anchors, one around the li, and
one around the text, but the <li> is parent to the <div>. The div is made
from the buildlist() function, and i dont want to mess with it since it
works for other functions. Maybe I could logically check if the caller
function is the one to do this specific tree, and then instead of having
<li class="open/close">, directly do <a><img class="open/close"></a> then
do the <li>..... this would get rid of <li> being in the anchor and
encompassing the whole div .
But seriously, this part comes after figuring out the AJAX update that is
not working.
---Time passes --
Ok I tried adding in <img> etc. and it totally made the website not even
include the sidebar!!! seems like code really is addicted to the old html
tag tree.


-Bazz

p.s.

I also took note of the file/funcs below but they don't seem to be "doing
the work"
  I am not sure when these codes are called, and when they do they
will maybe have to be modified too?

  media.php
   media_ns_tree_li()
   media_ns_tree()
   media_ns_tree_item

Other related posts: