ILIAS icon indicating copy to clipboard operation
ILIAS copied to clipboard

StaticURL: Add optional query parameters to static URLs

Open tbongers-cat opened this issue 6 months ago • 1 comments

In several internal use cases, we need static URLs to be able to include specific query parameters, e.g. for setting filters or search terms. As the current $additional_parameters in StandardURIBuilder only support "unnamed" parameters and ignores any specified keys, we have added the ability to specifically include parameters which are kept as a query string.

We would therefore like to propose this addition, because it may be useful for other use cases as well.

tbongers-cat avatar Jun 05 '25 06:06 tbongers-cat

@chfsx Do you feel responsible here? Or shall I move add the "shepherd" label?

klees avatar Jun 23 '25 14:06 klees

hi @chfsx would you mind to have a look at this? If you don't find the time for it we'll label it as looking for shepherd.

rfalkenstein avatar Aug 05 '25 11:08 rfalkenstein

Hi @chfsx ,

a quick look into this would be highly appreciated. We also accept a "I don't feel responsible for this/I currently have no time to review this" :-).

Best regards, Michael

on behalf of the ILIAS e.V. and the Technical Board

mjansenDatabay avatar Sep 02 '25 10:09 mjansenDatabay

From my point of view, this somewhat contradicts the concept of ‘static’ URLs, as the queries make them dynamic again in a way. However, I think you could already achieve the same thing by using, for example,

https://test9.ilias.de/goto.php/search/knowledge instead of https://test9.ilias.de/goto.php/search?term=knowledge

chfsx avatar Sep 29 '25 11:09 chfsx

From my point of view, this somewhat contradicts the concept of ‘static’ URLs, as the queries make them dynamic again in a way. However, I think you could already achieve the same thing by using, for example,

https://test9.ilias.de/goto.php/search/knowledge instead of https://test9.ilias.de/goto.php/search?term=knowledge

Hi @chfsx I see the problem with calling these 'static' URLs, as they are rather a specific "view" of a static page (in this case search) which a user might want to share.

In your scenario, how would you address URLs with several dynamic parameters like these: https://test9.ilias.de/goto.php/search?term=knowledge&filter=foo&filter2=bar https://test9.ilias.de/goto.php/search?term=knowledge&filter2=bar https://test9.ilias.de/goto.php/search?description=knowledge&filter2=bar

tbongers-cat avatar Sep 29 '25 13:09 tbongers-cat

Of course, this isn't the most elegant solution, but it would work: you can map the key-value pairs this way and then simply use the handler to convert them back into keys and values:

https://test9.ilias.de/goto.php/search/term/knowledge/filter/foo/filter2/bar https://test9.ilias.de/goto.php/search/term/knowledge/filter2/bar https://test9.ilias.de/goto.php/search/description/knowledge/filter2/bar

Or you could use something like

https://test9.ilias.de/goto.php/search/term:knowledge,filter2:bar and resolve it internally yourself.

Of course, the corresponding handler must support this.

The service doesn't care what you include, as long as it remains a valid URL. You could even pack an associative array into a token via \ILIAS\FileDelivery\Token\DataSigner::sign(). This would no longer be a readable URL, but you could include a lot of data in a URL-compliant format. Of course, this cannot be done ‘externally’, only internally in ILIAS (code).

I can see the use case, but I don't like the idea of extending the service with query parameters. However, I also don't see where such a URL should be displayed in the core. Can you help me with that?

chfsx avatar Sep 29 '25 13:09 chfsx