Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsort sorts namespaces and pages together #111

Closed
wants to merge 3 commits into from

Conversation

rolfik
Copy link

@rolfik rolfik commented Oct 11, 2014

When nsort sorting option is switched on, namespaces and pages on the same index level are sorted together.
I use it with msort option as well.
Original behaviour sorted namespaces first and then sorted pages were added.
Maybe new sorting option can be added for this mode.

When nsort sorting option is switched on, namespaces and pages on the same index level are sorted together.
I use it with msort option as well.
Original behaviour sorted namespaces first and then sorted pages were added.
Maybe new sorting option can be added for this mode.
foreach($dirs_and_files as $dir_or_file) {
$data[] = $dir_or_file;
// MI: directory
if(array_search($dir_or_file, $dirs_tmp, true) !== false && $dir_or_file['return']) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick response:
Does the item `$dir_or_file not contain a property specific for folder vs file? Or is it otherwise not cheaper to add such a property?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not studied the code enough to answer, because PHP is not my prefferred language ;-)
These changes are what suits me in my case now...
Please feel free to make any modifications with better knowledge of the background.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The item array has the entry: $dir_or_file['type'].
The value of this entry may be equal to d (unfolded d irectory), l(directory, l oad content of directory later) or f (f ile). So you can check for $dir_or_file['type'] != 'f'.

Hmm, I don't know how I can add commits to your fork. I think I will look how I can add some tests. I like to ensure that the way of handling empty folders is maintained.

@Klap-in
Copy link
Collaborator

Klap-in commented Oct 11, 2014

Thanks for this great addition!
There have been a couple of requests for this in the issues/disscussion, so users of the indexmenu will appreciate it.
e.g. #66

I think this is worth an sorting option. Not every one needs always sorting the dirs and the files together. This is useful for the backward compatibility as well.

I expect that the performance will not derogate too much, but did you test this maybe with some larger data sets already?

@rolfik
Copy link
Author

rolfik commented Oct 12, 2014

I have not tested the performance much. Anyway some property like IsDirectory would help on items instead of searching directories array.

@e-dschungel
Copy link

Is there any chance that this PR gets merged in the official master?

@rgleason
Copy link

rgleason commented Dec 6, 2016

This would sure be a nice improvement for those working with "book" and "chapter" formats.

@Klap-in
Copy link
Collaborator

Klap-in commented Dec 6, 2016

I still need to test this, for some different situations.

If others have time for testing, please be welcome to do and report what you test and whether the results were like your expectations.

@AndreKR
Copy link

AndreKR commented Jan 19, 2019

FWIW, I applied this to my installation and it works like a charm, thank you!

What I did:

  • Change to lib/plugins/indexmenu
  • Download this MR as a patch using wget by appending .patch to this URL:
    wget https://github.com/samuelet/indexmenu/pull/111.patch
  • Apply it with patch -p1 < 111.patch

@rfertig
Copy link

rfertig commented Jan 19, 2019

Which version is your installation?

@g-wenzel
Copy link

FWIW, I applied this to my installation and it works like a charm, thank you!

What I did:

* Change to `lib/plugins/indexmenu`

* Download this MR as a patch using wget by appending `.patch` to this URL:
  `wget https://github.com/samuelet/indexmenu/pull/111.patch`

* Apply it with `patch -p1 < 111.patch`

Thanks for the advice. I would like to add, that the options nsort AND tsort have to be switched on for this to work (tested with the current release 'Hogfather').

eduardomozart added a commit to eduardomozart/indexmenu that referenced this pull request Sep 14, 2022
Similar to samuelet#111 but updated for IndexMenu 5.0 release.
Klap-in added a commit that referenced this pull request Jan 4, 2024
Fixes #66
Fixes #202
Based on #259, which was based on #111
@Klap-in
Copy link
Collaborator

Klap-in commented Jan 4, 2024

@rolfik Thanks for contributing this long time ago and your patience! I have implemented it manually due to conflicts with the changes by @eduardomozart due to conflicts.

@Klap-in Klap-in closed this Jan 4, 2024
Klap-in added a commit that referenced this pull request Jan 8, 2024
Fixes #286, to restore default group behaviour if nsort is used.

Extends dcc823f

See also issue #66 and #202, and PR #259 and #111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants