Ticket #525 (closed Bug: fixed)

Opened 3 months ago

Last modified 3 months ago

Media does not support js/css in subfolders

Reported by: joeyb Assigned to: JAAulde
Priority: minor Milestone: 2.1.2
Component: Modules:Media Version: SVN HEAD
Keywords: media subfolders Cc:
SVN Revision (if applicable):

Description

The media module does not support js/css that is in a subfolder of the media/js or media/css folder. My plan was to keep my js files in subfolders for each controller (ex. media/js/page, media/js/user, etc.). To fix this issue, this is what I changed in media/controllers/media.php:

Change:

public function js($querystr)

To

public function js()

And add

$querystr = implode('/', $this->uri->argument_array());

To the beginning of that function. The same changes should be made to the css() function. This works properly as long as '/' is not used as your media separator.

Attachments

media.controller.diff (0.7 kB) - added by joeyb on 03/30/08 13:33:14.

Change History

03/28/08 09:54:48 changed by Shadowhand

  • status changed from new to closed.
  • resolution set to duplicate.

This bug is a duplicate of #311. Please search before reporting bugs.

03/30/08 13:23:54 changed by Shadowhand

  • status changed from closed to reopened.
  • resolution deleted.

03/30/08 13:24:11 changed by Shadowhand

  • status changed from reopened to new.

03/30/08 13:33:14 changed by joeyb

  • attachment media.controller.diff added.

03/30/08 13:36:12 changed by joeyb

I think this bug was supposed to be fixed in #311, but it still exists in SVN HEAD. It's a pretty simple fix, basically $querystr only gets the first segment of the path to the js/css file, so my fix just uses uri::argument_array() to get the full path. I have attached a .diff with the changes needed.

04/17/08 18:12:29 changed by JAAulde

  • owner changed from gregmac to JAAulde.

gonna take a look at this

04/17/08 21:39:46 changed by JAAulde

applied what i am not sure is a usable fix...committed to trunk in r2529 merged to releases/2.1.2 in r2529

i could totally remove the $querystring param as it would change the exposed interface which i can't do until 2.2 however, given that this is a controller and how those work, i am not sure this actually changed anything.

let me know for sure, joeyb, and I'll either close it or move it to 2.2 so that we can consider changing the exposed interface

04/17/08 21:40:44 changed by JAAulde

why do i typo everything...? change last comment revision history to:

committed to trunk in r2528 merged to releases/2.1.2 in r2529

04/19/08 23:00:15 changed by joeyb

hmm, unless I am missing something just adding the is_string check to $querystr is not going to work because $querystr will always be a string.

For example, if you try to go to http://localhost/media/js/mypage/myjs.js, $querystr = mypage. This means that using js/css in subfolders is still broken. I think the only way to fix it is to remove the $querystr parameter and just use $this->uri->argument_array() to get the full path.

04/20/08 18:28:26 changed by JAAulde

yeah, that's what i was saying when I said i didn't think i actually fixed anything given the way controllers work.

having taken a closer look, though, i think we can apply your suggested change even in 2.1.2 as it doesn't really change the exposed interface. since controller methods aren't directly called by a developer no one should notice the difference.

lemme run it by the other devs, though, and make sure this is ok for 2.1.2

04/20/08 18:38:27 changed by JAAulde

removed my pathetic attempt at a fix from trunk in r2542 and merged to releases/2.1.2 in r2543

04/20/08 19:41:54 changed by JAAulde

  • status changed from new to closed.
  • resolution set to fixed.

fixed with your original suggested fix. committed to trunk in r2544, merged to releases/2.1.2 in r2545

you can now use urls like this:

/media/js/dir1/script.js /media/js/dir1/script.js,somedir/script2.js /media/js/dir1/script.js,scriptfile.js