Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
22 Oct 2011 at 14:52 UTC
Updated:
4 Jan 2014 at 01:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
berkas1 commentedplease add README.txt file into your repository
Comment #2
attiks commentedPlease note: The Coder module currently has an unresolved flaw which will prompt you to add file declarations to your .info file even when it's not necessary to do so. Please do not try to make this warning go away by declaring files which do not contain classes or interfaces.
Severity minor, Drupal Coding Standards
sites/all/modules/route_planner/route_planner.module:
+17: [minor] There should be no trailing spaces
+18: [minor] There should be no trailing spaces
+30: [minor] There should be no trailing spaces
+35: [minor] There should be no trailing spaces
+64: [minor] Use an indent of 2 spaces, with no tabs
+83: [minor] There should be no trailing spaces
+87: [normal] use a space between the closing parenthesis and the open bracket
+97: [minor] There should be no trailing spaces
+110: [minor] There should be no trailing spaces
+112: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
+118: [minor] There should be no trailing spaces
+127: [minor] There should be no trailing spaces
+128: [minor] There should be no trailing spaces
+129: [minor] There should be no trailing spaces
+131: [minor] There should be no trailing spaces
+135: [minor] There should be no trailing spaces
+151: [minor] There should be no trailing spaces
+152: [minor] There should be no trailing spaces
+153: [minor] There should be no trailing spaces
+155: [minor] There should be no trailing spaces
+159: [normal] use a space between the closing parenthesis and the open bracket
+160: [minor] There should be no trailing spaces
+161: [normal] String concatenation should be formatted with a space separating the operators (dot .) and the surrounding terms
+162: [minor] There should be no trailing spaces
sites/all/modules/route_planner/route_planner.admin.inc:
+33: [minor] There should be no trailing spaces
+50: [minor] There should be no trailing spaces
+57: [minor] There should be no trailing spaces
+58: [minor] Use an indent of 2 spaces, with no tabs
Status Messages:
Coder found 1 projects, 3 files, 4 normal warnings, 24 minor warnings, 0 warnings were flagged to be ignored
Comment #3
bofrost commentedThanks for this advise to this really cool coder module. I checked my module and make all notices away.
Readme file is also added and I have created a new Branch 7.x-1.0.
Thanks for your Feedback
Comment #4
bofrost commentedComment #5
attiks commentedYou have to delete the branch 7.x-1.0, it will confuse Drupal when making releases!
Branches are always named 7.x-1.x, which you did already http://drupalcode.org/sandbox/Drupaldise/1315890.git/shortlog/refs/heads...
Comment #6
attiks commentedComment #7
bofrost commentedI'm very sorry that I'll make so much trouble, but it is very difficult and sometimes confusing for me how the procedures for module creation will work.
I have now merged the branch 7.x-1.0 with 7.x-1.x and then deleted the branch 7.x-1.0
Thanks for your patience
Comment #8
attiks commentedSome remarks:
1/ Small typo: interesst ==> interest.
2/ Maybe add in the README / Project description that this is a block, I had to look at the code to find out.
3/ Put your javascript inside a separate file, so it can be cached/aggregated.
4/ Mention that this module requires javascript to function.
5/ Mention that both blocks need to be enabled (maybe use 1 block?).
Comment #9
bofrost commentedWhere have you find this?
I have added some more description.
Done
I checked the new stuff with coder module and I also updated the project page.
Thx
Comment #10
attiks commentedFor your javascript use the following to encapsulate your code:
Comment #11
bofrost commentedOk, I have modified my js file in this way.
I realized that I have to learn quite a lot more about the Drupal Coding Standard or API.
Do you know a good Documentation Page about "Drupal.behaviors" I could not find something what is easy to understand.
For what is that needed? Or why was my way not good enough?
Comment #12
attiks commentedDrupal handles to loading of all javascript by using the Drupal.behaviors that way Drupal can control the loading of it, this mostly matters when your page is using AJAX callbacks to Drupal. By using the once method your code will only be added once to the page, even in case of an AJAX callback.
'Best' documentation I've found is http://drupal.org/node/756722
Comment #13
attiks commentedYou have to use Drupal.settings to pass parameters to your javascript file, see http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_ad...
Some small fixes
diff --git a/route_planner.js b/route_planner.js
index 115c91a..05e45cd 100644
--- a/route_planner.js
+++ b/route_planner.js
@@ -2,18 +2,20 @@
Drupal.behaviors.routeplanner = {
attach: function (context, settings) {
$('body', context).once('routeplanner', function () {
- Drupal.myRoutePlanner = new Drupal.RoutePlanner();
+ if (!Drupal.myRoutePlanner) {
+ Drupal.myRoutePlanner = new Drupal.RoutePlanner();
+ }
});
}
};
Drupal.RoutePlanner = function() {
- // initialize the map
- $(document).ready(function() {route(); });
-
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
+
+ // initialize the map
+ this.route();
}
Drupal.RoutePlanner.prototype.route = function(){
diff --git a/route_planner.module b/route_planner.module
index 79e0607..62105e9 100644
--- a/route_planner.module
+++ b/route_planner.module
@@ -79,7 +79,7 @@ function route_planner_address_form($form, &$form_state) {
'#type' => 'button',
'#value' => t('Calculate Route'),
);
- $form['button']['#attributes'] = array('onClick' => 'calcRoute();return (false);');
+ $form['button']['#attributes'] = array('onClick' => 'Drupal.myRoutePlanner.calcRoute();return (false);');
return $form;
}
Comment #14
bofrost commentedDone
Comment #15
attiks commentedhave a look at the included patch, it uses Drupal.settings to pass the parameters
Comment #16
attiks commentedComment #17
bofrost commentedokay... I have applied the patch
hopefully it is done now. A lot of work for such a small module.
Comment #18
attiks commentedDrupal is getting used to ;p, but good work! Someone else will have a second and will change the status accordingly.
Comment #19
bofrost commentedthanks for all your help!
Comment #20
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.
Manual review:
Comment #21
bofrost commentednew trial, all things fixed
Comment #22
attiks commentedA small remark, but non-blocking: you can move your settings to the block itself, see http://api.drupal.org/api/drupal/modules--block--block.api.php/function/...
you can optimize
'#attributes' => array('readonly' => 'readonly'), see http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....$output = drupal_get_form('route_planner_address_form');there are 2 spaces after =for your settings form, if you use something like the following, you don't need a submit handler and if you change it, rename all variables to route_planner_
Comment #23
bofrost commentedI really must say, that I learn a lot...
A new trail is in the sandbox! -> all things fixed
Comment #24
attiks commentedI did some more cleaning, see attached patch:
Can you try the patch and see if it's ok?
Comment #25
attiks commentednew patch
Comment #26
bofrost commentedNice one! Thanks for your cleanup, the patch is applied and in the repo.
Comment #27
attiks commentedroute_planner.js has some tabs on lines 32-36
but this looks good to me, changing status. someone else will have another look.
Comment #28
klausiThere is a security vulnerability in route_planner_map_display() line 157. First, you must not run filter_xss() on parts of HTML elements, see here http://drupalscout.com/knowledge-base/using-filter-functions-intended-fi...
Second, you should not use filter_xss() here because you don't want to pass through markup anyway. Use check_plain() instead of filter_xss(). See also http://drupalscout.com/knowledge-base/drupal-text-filtering-cheat-sheet-... for details on what function to use in which case.
I also looked at the unsanitized variables that you pass to the Javascript settings, but they go through drupal_json_encode() in the process and therefore do not pose an XSS security risk.
Automatic review:
Review 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 #29
klausitagging
Comment #30
bofrost commenteddone
Comment #31
klausido not RTBC your own issues.
Comment #32
bofrost commentedokay, sorry
Comment #33
attiks commentedLooks good to me
Comment #34
klausiThanks for your contribution, Drupaldise! 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 mind: Commit messages - providing history and credit and Release naming conventions.
Comment #35.0
(not verified) commentedUpdated issue summary.