The original idea can be found here: https://forum.team-mediaportal.com/improvement-suggestions-46/allow-skins-plugins-parameters-74058/
I'll outline the idea again: The patch adds a new property (hyperlinkParameter) to GUIButtonControl. This property will be passed to the plugin that is opened with the hyperlink property. The plugin can then open a specific view/site/part of the plugin, depending on the parameter.
Here are some usecases for a few of the most popular plugins:
MovingPictures
The BasicHome screen contains two hyperlinks to MovingPictures with two different hyperlinkParameters
MP-TVSeries
The BasicHome of skin x contains two links to mp-tvseries each with a different hyperlinkParameter
OnlineVideos
BasicHome will have own icons for OnlineVideos->Youtube and OnlineVideos->GameTrailers, you get the idea
Other Plugins
Implementation
That's why I think why this patch would provide an improvement to MediaPortal, now here's what I've done:
- Added skin property to GuiButtonControl class
- When button is pressed and contains a hyperlink AND a hyperlinkParameter the method
is called instead of
- the parameter will be added (as lpVoid) to the GuiMessage GUI_MSG_WINDOW_INIT
- in the GUIWindow class, the parameter will be stored in the new field _loadParameter
- a plugin can then check if(_loadParameter != null) in the OnPageLoad() method
Remarks:
Patch: View attachment AllowSkinToOpenPluginWithParameter.patch
Files for testing (Needs the latest svn snapshot and MovingPictures 1.0 installed), just overwrite the files with the ones included in the rar file and you'll have a BasicHome that opens moving pictures in different category views.
View attachment LoadMovingPicturesWithSpecifiedCategory.rar
I'll outline the idea again: The patch adds a new property (hyperlinkParameter) to GUIButtonControl. This property will be passed to the plugin that is opened with the hyperlink property. The plugin can then open a specific view/site/part of the plugin, depending on the parameter.
Here are some usecases for a few of the most popular plugins:
MovingPictures
The BasicHome screen contains two hyperlinks to MovingPictures with two different hyperlinkParameters
- Link 1 is named "Kids Movies" and will open MovingPictures with the category defined for save usage by the children
- Link2 is named "Movies" and will open MovingPictures and show all movies (it may be secured with a pin)
MP-TVSeries
The BasicHome of skin x contains two links to mp-tvseries each with a different hyperlinkParameter
- Link 1 will open mp-tvseries and show Bobs Favorite series
- Link2 will open Janes favorite series
- Link3 will show all shows for the kids
OnlineVideos
BasicHome will have own icons for OnlineVideos->Youtube and OnlineVideos->GameTrailers, you get the idea
Other Plugins
- MyTrailers can be called from other plugins with an imdb id as parameter, MyTrailers will show trailer for this specific movie
- Weather plugin could be called for different cities
- ...
Implementation
That's why I think why this patch would provide an improvement to MediaPortal, now here's what I've done:
- Added skin property to GuiButtonControl class
Code:
[XMLSkinElement("hyperlinkParameter")] protected string _hyperLinkParameter = "";
- When button is pressed and contains a hyperlink AND a hyperlinkParameter the method
Code:
GUIWindowManager.ActivateWindow((int)_hyperLinkWindowId, _hyperLinkParameter);
Code:
GUIWindowManager.ActivateWindow((int)_hyperLinkWindowId);
- the parameter will be added (as lpVoid) to the GuiMessage GUI_MSG_WINDOW_INIT
- in the GUIWindow class, the parameter will be stored in the new field _loadParameter
Code:
protected string _loadParameter = null;
Remarks:
- I did consider using a second OnPageLoad(string parameter) method but this would cause sideeffects with the overrides
- I talked to fforde (movingpictures) and damienh (mp-tvseries) and both agreed that a simple string would be sufficient as a parameter
- This is my first patch so please be gentle Comments are very welcome!
Patch: View attachment AllowSkinToOpenPluginWithParameter.patch
Files for testing (Needs the latest svn snapshot and MovingPictures 1.0 installed), just overwrite the files with the ones included in the rar file and you'll have a BasicHome that opens moving pictures in different category views.
View attachment LoadMovingPicturesWithSpecifiedCategory.rar
- Modified BasicHome.xml for Blue3Wide
- Modified MovingPictures 1.0
- Modified Core.dll (including the changes)