Bug 17409 - Third party menus ordered incorrectly
: Third party menus ordered incorrectly
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Web Interface
: 7.6.0
: PC Other
: -- normal (vote)
: 7.6.1
Assigned To: Michael Herger
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-07 04:45 UTC by Erland Isaksson
Modified: 2011-08-18 15:01 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments
Patch that corrects menu ordering. (691 bytes, patch)
2011-08-07 04:45 UTC, Erland Isaksson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Erland Isaksson 2011-08-07 04:45:17 UTC
Created attachment 7381 [details]
Patch that corrects menu ordering.

Third party menus added dynamically is currently ordered incorrectly, they all
show up on top above all the other standard menus.

The issue is that the quick sort algorithm currently doesn't work because it
assumes all compared menu pairs either:
- both is the main plugin menu
or
- both is not a main plugin menu

The attached patch solves the issues.
Comment 1 SVN Bot 2011-08-07 22:06:27 UTC
 == Auto-comment from SVN commit #33008 to the slim repo by mherger ==
 == http://svn.slimdevices.com/slim?view=revision&revision=33008 ==

Fixed Bug: 17409
Fixed Bug: 17410
Description: fix menu ordering in the web UI
Comment 2 Adrian Smith 2011-08-09 11:06:33 UTC
Erland,

Is it possible to do this by adding plugin weight values?

When I updated the code to get the ordering right for SMD I noticed that the rank preferences are not used in the command interface.  This patch also makes the button and web interface logic different.  So it would seem to me to be preferable to depreciate the rank prefs for entries and try to do by plugin weights if we can.  If this needs adding a method to set the weight of a dynamically generated web page then we should do this?
Comment 3 Erland Isaksson 2011-08-09 11:36:06 UTC
(In reply to comment #2)
> Erland,
> 
> Is it possible to do this by adding plugin weight values?
> 

I've one plugin that needs to be able to provide multiple menus with different weight values, but if you are talking about making it possible to register a weight for a specific menu key I like that idea, the current "rank-xxx" preferences feels a bit dirty.
Comment 4 Adrian Smith 2011-08-09 12:10:55 UTC
As a hack today you can probably add entries to the plugin $WEIGHTS hash by:

$pluginclass->getWeights->{ $token } = $weight;

This will add entries to the hash stored in Slim::Plugin::Base.

We should probably expose this more formally by creating a setWeight method in the base class which does this?   Would this provide what you need?
Comment 5 SVN Bot 2011-08-09 21:43:56 UTC
 == Auto-comment from SVN commit #33029 to the slim repo by mherger ==
 == http://svn.slimdevices.com/slim?view=revision&revision=33029 ==

Bug: 17409
Description: improve change to make MusicIP use weights instead of legacy rank values. Unfortunately MIP isn't based on Slim::Plugin::Base, therefore we need a helper method to add the weight.
Comment 6 Erland Isaksson 2011-08-09 23:00:37 UTC
(In reply to comment #5)
> == Auto-comment from SVN commit #33029 to the slim repo by mherger ==
>  == http://svn.slimdevices.com/slim?view=revision&revision=33029 ==
> 
> Bug: 17409
> Description: improve change to make MusicIP use weights instead of legacy rank
> values. Unfortunately MIP isn't based on Slim::Plugin::Base, therefore we need
> a helper method to add the weight.

Just for information, I've switched Custom Browse to use the new Slim::Plugin::Base->addWeight method you just added.

There still seems to be standard SBS code that uses rank-xxx, I'm not sure if that could be changed too or if it will cause other problems. Run a grep for "rank" in the code and you will find it in a few places. I'm guessing it's probably not urgent to change this as it probably doesn't cause any issues.
Comment 7 Dennis Mutsaers 2011-08-18 13:25:12 UTC
I wouldn't say it's fixed. SugarCube is still listed on top.

http://forums.slimdevices.com/showpost.php?p=650042&postcount=8

7.6.1 - r33110
Comment 8 Michael Herger 2011-08-18 15:01:45 UTC
> I wouldn't say it's fixed. SugarCube is still listed on top.

Please tell its author to update his plugin by adding a weight function:

sub weight { 99 }