Project page: http://drupal.org/sandbox/DWB/1078406
I would like to contribute a lightweight module I named 'DropIn'. It does only one thing: detect the presence of CSS files on the server based on the visitor's URL, and if present, add it to the <head> of the page. I've used this kind of functionality with the Zend framework and often found it very convenient.
For example, when a visitor requests www.example.com/news/articles/issue-1, the module will look for the next css files in the theme directory:
- news.css
- news_articles.css
- news_articles_issue-1.css
In case any of them are found, they're added to the page's css stack to do their work on (in this example) a section of pages, a sub-section or only 1 page.
The module is meant to be used by website developers / administrators.
A lot of text for a very small module, I hope it's all clear.
Kind regards
| Comment | File | Size | Author |
|---|---|---|---|
| #24 | dropin_review.diff | 4.09 KB | ishanmahajan |
| #1 | allcss.zip | 2.02 KB | DWB Internet |
Comments
Comment #1
DWB Internet commentedHere's my zipped module.
Comment #2
DWB Internet commentedComment #3
arianek commentedHi. Please read all the following and the links provided as this is very important information about your CVS Application:
Drupal.org has moved from CVS to Git! This is a very significant change for the Drupal community and for your application. Please read the following documentation on how this affects and benefits you and the application process:
Migrating from CVS Applications to (Git) Full Project Applications
Comment #4
DWB Internet commentedChanged status according to instructions.
Comment #5
avpadernoComment #6
DWB Internet commentedLink to the experimental project page: http://drupal.org/sandbox/DWB/1078406
(Acciddently I submitted this project as a new Project application as well, only later finding out I should update the submission here. See: http://drupal.org/node/1078438)
Thank you.
Comment #7
DWB Internet commentedAs I added support for javascript files too, the project name didn't seem appropriate anymore so I changed it into 'DropIn'.
(I haven't yet adapted the code to the new name).
Comment #8
DWB Internet commentedChanged the name of this thread to better accommodate the module.
Comment #9
DWB Internet commentedComment #10
sreynen commentedHi DWB,
I see a few issues with your code. First, you should install http://drupal.org/project/coder and fix any issues it reports. Most of what I see are whitespace issues, but there might be more. In addition to what coder will tell you, some other feedback:
Comment #11
DWB Internet commentedThanks for your review sreynen!
I made the suggested changes and reformatted some of the code according to the coding standards (I thought I had the formatting right in the first place but there were a few spaces and tabs in places they didn't belong).
nbproject directory, $id$'s, ill-placed underscores and hook_install() are removed.
Comment #11.0
DWB Internet commentedremoved some needless text
Comment #12
sreynen commentedHi DWB,
Sorry this has been waiting so long. We have a huge backlog on reviews and not enough volunteer hours to look at them quickly. I just looked at this again and see some issues:
Comment #13
DWB Internet commentedHi sreynen,
Thanks for your review. It's suprising to see how many small deficiencies can be found when the code is reviewed through someone else's eyes.. I applied your proposed changes and retested the module to make sure everything still works as planned after the changes I made. Looking forward to your opinion.
Regards
Comment #14
DWB Internet commentedComment #15
jthorson commentedA few more (trivial) points:
Interesting concept, and looks well executed ... as a feature suggestion, it would be nice to have an admin setting where you define specific paths where this check is invoked (similar to the 'show this block on:' path listing on block config pages), instead of having the hook_init script run on every single page.
Comment #15.0
jthorson commentedSmall text modification
Comment #15.1
DWB Internet commentedminor change
Comment #16
DWB Internet commentedThanks for your suggestions, jthorson. I didn't know a readme file was mandatory for modules, I found out by reading http://drupal.org/node/447604. So I added it to DropIn. I also implemented the missing translations.
Your feature suggestion (admin setting to define paths) is certainly worth considering. It could have a button to detect the files and cache them so you wouldn't have to add them manually.
Regards
Comment #17
DWB Internet commentedComment #18
klausiComment #19
DWB Internet commentedHi klausi, thanks for your extensive and well-documented review! My reworked code now can be found in the major version branch (7.x-1.x).
Apart from he issues you listed, I ran the module through coder which I hope has solved all the formatting issues.
Regards
Comment #20
glekli commentedAfter reviewing your module, I have to say I did not find many things that could be an issue. Here is one, though:
In line 20, why do you use DIRECTORY_SEPARATOR to split a Drupal path? On Win servers it is set to backslash, although the Drupal path is always separated with forward slashes. Also, the PHP function split() is deprecated; you could use explode() instead.
Comment #21
DWB Internet commentedHi Gergely, thanks for reviewing DropIn!
You're right about the DIRECTORY_SEPARATOR. In general I suppose it's good practice to use DIRECTORY_SEPARATOR for splitting/exploding paths that are given by the OS, which of course is not the case here.
In my memory explode() was the deprecated one but I see you're right.
I followed both your suggesions and changed the code.
Regards.
Comment #22
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. Please report any bugs to klausi.
Comment #23
DWB Internet commentedThanks for your patience, Klausi (and other reviewers)! In #19 I ran my code through the online coder instead of the module, which probably explains the issues I missed. I Installed and used the module this time, giving me the same results as yours.
I solved the issues and uploaded the reworked code.
Regards
Comment #24
ishanmahajan commentedHi DWetc,
Review of 7.x-1.x branch:
The issues pointed in #22 are fixed. The module passed coder.
Some suggestions:
Attaching the patch.
Comment #25
DWB Internet commentedThanks for your review ishanmahajan, and the patch included.
You're probably right in that using 'dropin' in the code and file names adds to the clarity of the module and the code. So I fixed that.
Line 34 and line 44: defined a constant 'JS_DROPIN'. It is better to use a constant here.
I've applied your patch except for the above part. I don't see why using a constant here would be better. Could you explain why you think so?
Otherwise all issues fixed.
Comment #26
DWB Internet commented(Forgot to change status)
Comment #27
klausiLooks good to me.
Comment #28
ishanmahajan commentedHi DWetc,
Using a constant here is not a big deal. It just makes the program easier to read and modify IMO. The module looks really good to me.
Comment #29
gregglesPlease take a moment to make your project page follow tips for a great project page.
Thanks for your contribution, DWetc! Welcome to the community of project contributors on drupal.org.
I've granted you the git vetted user role which will let you promote this to a full project and also create new projects as either sandbox or "full" projects depending on which you feel is best.
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
As you continue to work on your module, keep in minde: Commit messages - providing history and credit and Release naming conventions.
Comment #30
DWB Internet commentedThanks Greggles and everyone who took the time to review my code and help me make this into a Drupal worthy project!
Comment #31.0
(not verified) commentedAdded link to he project page