Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Jul 2012 at 14:07 UTC
Updated:
4 Jan 2014 at 02:05 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
parwan005 commentedhi,
did manual review of your code.
Found following issues:-
1. You have followed proper indentation in your init function. Please refer http://drupal.org/coding-standards/#indenting for this purpose. Here you will get better idea how it should be done.
2. you have used variable_get function and not set its default value which is incorrect practice. You must set its default value whenever you call this function.
3. Make sure every file in your module ends with an new line, which is not happening currently.
4. You havent mentioned core in your info file, which i believe should always be there.
For automated review click here. You are also supposed to fix these issues.
Thanks
Comment #2
jibus commentedhi parwan005,
Thanks for your time and for your review
1. fixed
2. fixed
3. fixed
4. Core is mentioned (7.x)
Comment #3
jibus commented! Auto self-review mode !
1 - The plugin used in the module is not compatible with Drupal (jquery.scrollfollow.js -> MIT Licence). Need to set this as a third party
2 - jquery_scroll_follow.install -> wrong function name in hook_uninstall().
Working on this now !
Comment #4
jibus commentedAll fixed !
Since i didn't made enough review (two at this time), i am not in the hurry =)
Comment #5
Milena commentedYou are using module Libraries API to get external .js library, but you have no dependency in your .info file. Please, add proper dependency.
There is still a master branch, make sure to set the correct default branch: http://drupal.org/node/1659588 . Then remove the master branch, see also step 6 and 7 in http://drupal.org/node/1127732
Some typos in settings form - of course it is not a bug.
Css classe(s) - should be CSS class(es) probably or simply CSS classes
Css classes (separated by a comma) - CSS classes (separated by a comma)
I think that if you want to have classes separated by a comma there is no need for textarea field. Simple textfield should be OK.
Your module has it's own settings page, so it would be good to put path to it in .info file
configure = path/to/your/settingsSmall icon will appear on module list then.
Also you do not need to type what value is a default value.
Even if user just installed your module variable_get function will show default value right away.
If you want users to have a chance to restore default values I would suggest adding "Restore default" button in settings page.
I was able to install module without Libraries API (dependency problem) and use it without js file in libraries folder.
It makes my all other scripts not working because of fatal error. You should probably check if there is a file and if there is no file do not add it to the code. It is not sufficient to place a warning in status file.
That's the only one reason I put status to needs work. Of course other issues (master branch) should also be fixed.
What's more in status report there is something wrong with the message.
Comment #6
hkirsman commentedGreat module!
Stumbled too on the js fatal error. Patch attached.
Comment #7
jibus commentedThanks for your review Milena and hkirsman
Fixed:
1] Libraries is now a depedency,
2] Removed master branch,
3] Fix typo
4] Update textarea to textfield in admin settings
5] Settings path is present in nfo file
6] "Restore default" button can be an futher developpment
7] Fix crash when the jquery plugin is not present
8] Update readme file and project page
Thanks =)
I still didn't made enough review, so take your time =)
Comment #8
rob holmes commentedHi there, useful module, could of done with this a few days ago.
Couple of minor points..
The plugin can also be passed a CSS ID instead of a class, also maybe explain that the DOT is required when specifying css classes, as I left them out originally when testing the module, maybe the description would be better worded as 'CSS selectors (Separated by a comma).
Line 33: the description should specify the Units e.g.
'The duration of the sliding animation (in milliseconds). The smaller the value, the faster the animation. (Default:500)'
Line 40: the description could be clearer e.g.
'Number of pixels the Scroll Follow object should remain from top of viewport. (Default:0)'
Line 47: the delay description could be clearer e.g.
'Time between the end of the scroll and the beginning of the animation in milliseconds. (Default:0)'
Lastly and this is NOT an issue, more of a question.... A lot of jQuery libraries i have installed use the path sites/all/libraries/jquery.PLUGINNAME/PLUGINNAME.js i'm not sure if there is any guidance on this at all but would it be cleaner if the default library path was sites/all/libraries/jquery.scrollfollow/jquery.scrollfollow.js ?
Comment #9
jibus commentedThanks Rob Holmes for your review
Commited your changes.
About your question, are you talking about the location path ? Or about the name of the path ?
Thanks again
Comment #10
jibus commentedReviews of other projects:
http://drupal.org/node/1804878#comment-6565174
http://drupal.org/node/1728308#comment-6343770
http://drupal.org/node/1674998#comment-6281096
http://drupal.org/node/1803282#comment-6564040
Comment #11
jibus commentedAdd PAReview: review bonus tag
Comment #12
cubeinspire commentedHi !
I've been looking around for some time as the library was not loading I guess it was a path problem and I succeed to solve it ! The problem is inside jquery_scroll_follow_init(). Line 68 of the .module.
1. Add
global $base_path;at the begining.2. Add this on the file_exists check.
if (file_exists($_SERVER['DOCUMENT_ROOT'] . $base_path . $jquery_scroll_follow_location . '/jquery.scrollfollow.js')) {Now the module works :-)
I don't see any major problem on it.
Comment #13
jibus commentedHi logicdesign,
Thanks for your review.
I wan't able to reproduce your problem. I tested on my local machine, the plugin is detected et loaded. Can you define your installation ? Did you use the default path or a custom path for the library ?
Thanks again
Comment #14
cubeinspire commentedfile_exists() function doesn't take relative paths.
See: http://www.php.net/manual/en/function.file-exists.php
Not all installations are on the public_html/ path of the server, sometimes Drupal can be in a subfolder.
In my case ( working with Ubuntu lamp ) I install it inside /var/www/d7/ and as I have not setup the Hosts for this Drupal site, I access the site with the following URL: http://localhost/d7/
In this particular situation $base_path will contain "d7/".
If the website was identified with a DNS pointing to that sub folder, for example http://local.d7/, the $base_path would contain "/".
File_exists tries to find the file in the internal server structure context.
This is why it needs the full internal path, not the URL path.
To make the file_exists function work correctly you need to give him the full internal path of the file.
In my case it would be:
"/var/www/d7/sites/libraries/jquery_scroll_follows/"
That path can be dynamically build using:
$_SERVER['DOCUMENT_ROOT'] . $base_path . $jquery_scroll_follow_location
You can also use the php function is_file() instead of file_exists(), as it is x2 faster.
See: http://be.php.net/manual/en/function.is-file.php
Comment #15
mpdonadiojquery_scroll_follow.js and jquery_scroll_follow_start.js appear to be identical, but only jquery_scroll_follow_start.js is referenced with drupal_add_js();
jquery_scroll_follow_start.js needs a little formatting TLC.
The README.txt mentions Libraries as a dependency, but it is not mentioned in the .info file as one.
The current library archive, jquery-scroll-follow.zip, has the JS file in a lib/ subdirectory. You should either use this location, or be really explicit in the docs what the path should be.
jquery_scroll_follow_requirements() has a small logic error in line 41. Your outer case is limiting this to the runtime phase, so this will always evaluate to REQUIREMENT_ERROR;
Long term, you may want to consider a better way to expose the feature instead of using a hook_init(). Not sure what you can do here, but there has been a trend to move away from using hook_init() and to use more specific hooks so that page request weight is lessened.
You may also want to add some logic to make sure the settings are "sane" before adding to the page. For example, make sure the CSS selector is valid, the other settings are numbers, etc.
Personally, I would have an "all OK" message on the status report and not just an error in your hook_requirements().
I installed and configured everything, set the settings (used .node as the selector), saw the JS on the page, but couldn't get anything to work.
May want to consider explicitly passing in Drupal and the JS settings, which prevents problems if another file alters them by accident:
You may also want to do a
parseInt(foo, 10)in case people use leading zeros by accident.Comment #16
jibus commented@logicdesign: thanks for your explanation. I used DRUPAL_ROOT instead of $_SERVER['DOCUMENT_ROOT'].
@matthew.donadio: thanks you for your review =)
Duplicate file. I removed it. Thanks
Fixed, thx
I updated the readme file.
Updated the function. Now there is a check of the file (instead of the folder). If the file is found, the message "Plugin jQuery Scroll Follow found" is set in the admin page status page. If not, the severity is set to REQUIREMENT_ERROR.
Good point. I will make some research about this. But for a first release, i think it should be OK.
From my point of view, it's a little bit "overkill" to check this. But thanks to suggest this !
Did you try on a block (ie login block for instance ?)
Comment #17
mpdonadioThe change to hook_requirements(), you still have something that looks like
Is that what you were going for?
Not working. When I scroll around, I can watch the changes with Firebug / FireQuery, but nothing happens. I suspect I need some CSS changes to handle the positioning added to my theme. My sandbox was just using the default Bartik. I suspect you just need a little more documentation around this.
Comment #18
jibus commentedOk, i removed the condition.
About the plugin, the documentation says:
I updated the readme file according to this
Comment #19
tdurren commentedManual review: nice simple plugin and code was clean.
(not an expert drupal reviewer so learning as I review )
Comment #20
mpdonadioI think this looks fine now. It is unclear to me, though, whether I can mark this RTBC or whether @klausi has to do that to move things to the next step.
Comment #21
cubeinspire commentedAs I understood from the explanations of Klausi during last Drupalcon ( http://munich2012.drupal.org/program/sessions/project-application-review-process - min 17 ) you can set it as RTBC if you are confident about the code quality.
Comment #22
mpdonadioComment #23
klausimanual review:
"'access arguments' => array('access administration pages'),": The administration menu callback should probably use "administer site configuration" - which implies the user can change something - rather than "access administration pages" which is about viewing but not changing configurations.
As this is a minor security issue I have to put this back to needs work, otherwise all looks good. Set this back to RTBC directly after you fixed the permission.
Comment #24
jibus commentedThanks for your review Klausi :)
I fixed the permission.
Comment #25
klausiThanks for your contribution, Jibus!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!
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.
Thanks to the dedicated reviewer(s) as well.
Comment #26.0
(not verified) commentedAdd reviews link from other project