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

Timetable Admin: refactor to use Url class for paths and url generation #1674

Draft
wants to merge 6 commits into
base: v25.0.00
Choose a base branch
from

Conversation

yookoala
Copy link
Member

@yookoala yookoala commented Oct 7, 2022

Description

  • Use __DIR__ and require_once for a more stable behaviour when routed through index.php.
  • Refactor to use Url class for paths and url generation.

Motivation and Context

  • Remove the use of $session->get('absoluteURL') from the module.
  • Fix all issue when using Timetable Admin through index.php routing. Some feature was still relying on direct routing on the script path.
  • Pave way for future router routing efforts.

How Has This Been Tested?

  • CI environment.

* Use __DIR__ and require_once for a more stable behaviour when
  routed through index.php.
* Replace all absoluteURL usages and relative URL paths
  with Url implementation.
* Besides accepting a 'q' parameter, it now also accepts a Url
  instance.
Copy link
Member

@SKuipers SKuipers left a comment

Choose a reason for hiding this comment

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

Hi Koala, you've done a lot of great work here, I think unfortunatly any of the forms using Url::fromModuleRoute will face the same problem highlighted in the Crowd Assessment PR: the links are prepending the index.php/ front-controller route rather than a direct link to the script. Curious to hear what your thoughts are in terms of handling those two different types of routes in the URL class: a new method, or a chained method modifier?

@yookoala
Copy link
Member Author

yookoala commented Oct 25, 2022

I think in long term, all the corner cases of the problem scripts need to be refactor so they works within index.php routing environment. Only then we can really migrate to path based routing (instead of script file based). It is strange that the form submit target cannot be routed from index.php.

I'm going to use the Crowd Assessment module as a test bed to try things out first. It is one of the smallest modules in Gibbon. Things should be simpler with it than the bigger ones. And before that, I'll need a better test coverage to the module.

@yookoala yookoala marked this pull request as draft November 4, 2022 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants