Open a certain accordion in preferences by URL parameter

When opening the preferences, by default the first tab “Preferences” and the second accordion “Preferences” is opened. One can use the tab URL parameter to select the initially open tab:

  • /prefs.php?tab=genConfig
  • /prefs.php?tab=feedConfig
  • /prefs.php?tab=filterConfig
  • /prefs.php?tab=labelConfig
  • /prefs.php?tab=userConfig
  • /prefs.php?tab=systemConfig

This is done via javascript in js/prefs.js init_second_stage()


Unfortunately, there is currently no way to select the open accordion inside the tab. I need this for my plugin that does external oauth stuff and then redirects back to the preferences, showing the successful registration at the end.

Currently already the second accordion is opened. This is done by adding selected="true" in the accordion’s HTML tab. So what’s needed in my eyes to make this work for other accordions is to

  1. transfer a accordion GET parameter from the initially called prefs.php to backend.php
  2. do not set selected="true" in the default preferences accordion if the parameter is present
  3. adjust my plugin to check if the accordion parameter is set to its name, and then print out selected="true" for its own accordion.

Here is a first patch that adds support for 1+2. What do you think?

http://tmp.cweiske.de/tt-rss-pref-accordion.diff

+		$prefSelected = isset($_REQUEST['accordion']) && $_REQUEST['accordion'] != ''
+			? '' : 'selected="true"';

do you want me to go add this to every panel because of your plugin? because basically lol nope

I need this for my plugin that does external oauth stuff and then redirects back to the preferences, showing the successful registration at the end.

like i told you on irc, you can use a separate window/browser tab for this. you can also use window.opener or AJAX to modify your expandable panel without reloading entire preferences.