nspages icon indicating copy to clipboard operation
nspages copied to clipboard

tree: add column option

Open 6227020800 opened this issue 2 years ago • 5 comments

First time coding in php so exercise scrutiny in review.

6227020800 avatar Sep 04 '22 15:09 6227020800

Updated to support legacy non-xhtml tree.

6227020800 avatar Sep 04 '22 16:09 6227020800

Would like to add cutoff for items per column in tree print still..

6227020800 avatar Sep 04 '22 16:09 6227020800

Thanks for your interest in this plugin and for your pull request :)

If I understand correctly, this changes the behavior of the tree rendering so that it displays several smaller trees. Could you help me understand if my understanding is correct ? If yes, could you please help me understand what use case it fits (or what problem is solves)?

Also, I'm seeing that it changes the default behavior for every user of the tree rendering. What about considering that this change could be activated by an option so only users who wants it would get it?

gturri avatar Sep 04 '22 18:09 gturri

Sure, first I took some of the basic tree functions that were already written and put it into printerITree.php. Then there are now 2 tree printers: printerTree and printerTreeXHTML. So the $mode will determine which tree is generated.

Next, I ripped out some column code from printerNice and created rendererColumnHelper for the column layout to be shared with printerTreeXHTML and printerNice.

Finally, focusing on printerTreeXHTML, we need to implement the _printTree and _printSubTree with the rendererXhtmlHelper and column layout. So I created a few helper variables $nbItemsPrinted, $nbItems. Overall, I copied the code as best I could using rendererXhtmlHelper.

If I understand correctly, this changes the behavior of the tree rendering so that it displays several smaller trees. Could you help me understand if my understanding is correct ? If yes, could you please help me understand what use case it fits (or what problem is solves)?

I don't expect or intend any changes to behavior for rendering although my understanding could be wrong. Starting from syntax. There are two render modes: XHTML and .metadata. For .metadata mode there will be no behavior change, that is routed to the original printerTree class. For XHTML, the default number of columns is one so users would not see any difference unless they add the -nbCol option.

So I am confused how do you see some behavior change. Please let me know if you see something specific.

Also, I'm seeing that it changes the default behavior for every user of the tree rendering. What about considering that this change could be activated by an option so only users who wants it would get it?

Unless -nbCol is added in combination with -tree the user should see no changes. The default column number is 1 for tree option.

I did notice that when switching to rendererXhtmlHelper, the CSS also changed slightly in terms of font weight. That could be fixed although not high priority.

6227020800 avatar Sep 04 '22 19:09 6227020800

Thanks for this explanation. So, I understand how this PR moves the code. On the other hand I'm afraid I still don't really understand the use case for that. Could you please help me understand the point of "slicing" the tree in sub-trees?

About the change in the way trees are rendered, here is for instance what I observe. Is this change expected? (your version of the plugin renders the part on the left). It's as if the bullet points are present only for pages...

2022-09-05 - nspages - pr130

gturri avatar Sep 05 '22 19:09 gturri

(closing because this PR still has open questions but was still inactive for more than 6 months)

gturri avatar May 07 '23 12:05 gturri