project: [D7] OSM Route

component: module

Overview

This module is born for the need to automatically retrieve and represent a route path starting from a list of coordinates (georeferenced entities) exploiting the YOURS REST APIs.

As far as we have investigated, there are no modules, nor workaround or easily patchable modules aimed at achieving the desired result.
In fact there are no route planning modules in the Drupal cauldron, except a few ones that are not enough versatile. For instance the interesting project routeplanner provides the possibility to build just a two points path, one of which is fixed.

Following Developer Guidelines

Project application check list has been followed, as well as licensing, documentation, and best practices checks.
As for security check, no queries to DB are made, e.g., for retrieving configuration data the Drupal api are always used. The few edit fields are built through the Drupal API and have been tested where used.

Coder (and Coder Sniffer), have been launched in order to adapt the source code and the repository to the Drupal community coding conventions. pareview.sh has been succesfully launched with no warnings.


Case Study


This module has already been succesfully tested and exploited inside the project TPE: Tourisme, Ports Environnement for http://www.maritimeit-fr.net/), thus I consider this module mature for publishing.

Project Inforrmation

Project home page: https://drupal.org/sandbox/artsakenos/2122323

Target: Drupal 7

Git Repo:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/artsakenos/2122323.git osm_route

PAReview.sh Results: http://pareview.sh/pareview/httpgitdrupalorgsandboxartsakenos2122323git

Reviews to other modules and further contributions

Review Bonus phase 01 (20 Dec 2013)

Went first time in RTBC on 26 January, then more features have been added also to provide driving instructions.

Review Bonus phase 02 (20 Dec 2014)

Further contributions

In the meanwhile I also contributed developing another module to retrieve the elevation profile of a given path. Also this module has been exploited in the projects above mentioned and in the evolution of the web site Sardegna Sentieri. I also started reviewing and patching other modules (e.g., imagemapster, workbench moderation).

CommentFileSizeAuthor
#23 test_osm_route.png388.04 KBGrimreaper
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

artsakenos’s picture

Status: Active » Needs review
PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

cheatlex’s picture

Status: Needs review » Needs work

Hi, a good idea for a module - first glance:

1.) The link to the project contained an empty a tag - cause it not to work.

2.) You only need the git where a reviewer can get the source not your own.

3.) Looks like there is some missing files line 9 in osm_route.module, you require "osm_route.admin.inc", I cant find this file anywhere ?, and insted of require this you should just add it in the .info file.

4.) You should make an install file with check for that curl is installed. take a look at: hook_requirements()

Other than that it looks fine but I cant install it.

artsakenos’s picture

Issue summary: View changes
Status: Needs work » Needs review

Dear cheatlex, thanks for your feedback and the precious suggestions.

1.) The link to the project contained an empty a tag - cause it not to work.

☑Fixed

2.) You only need the git where a reviewer can get the source not your own.

☑Fixed.

3.) Looks like there is some missing files line 9 in osm_route.module, you require "osm_route.admin.inc", I cant find this file anywhere ?, and insted of require this you should just add it in the .info file.

☑Fixed. The file had been removed last minute for mistake.

4.) You should make an install file with check for that curl is installed. take a look at: hook_requirements()

☑Fixed. The _requirements() hook has been implemented in order to verify the presence of the needed curl extension.

Further fixes:
The admin menu has been moved under the “services” category.

Bogdan1988’s picture

Hi artsakenos!
Here are some suggestions:
1) There is no hook_admin_settings(), please look here https://drupal.org/node/286528. I would recommend you to look here too https://drupal.org/node/1354#forms.
2) Please pay attention to validate and submit functions docs https://drupal.org/node/1354#forms.
3) here is the last suggestion. What if user need couple content types to be able to use OSM. Maybe you can add this ability.

Thank you for nice code!

artsakenos’s picture

Dear Bodgan1988, thanks for your kind suggestions.

1) There is no hook_admin_settings(), please look here https://drupal.org/node/286528. I would recommend you to look here too https://drupal.org/node/1354#forms.

☑Fixed.

2) Please pay attention to validate and submit functions docs https://drupal.org/node/1354#forms.

☑Fixed.

3) here is the last suggestion. What if user need couple content types to be able to use OSM. Maybe you can add this ability.

This is a interesting idea for future work, indeed! In my opinion at this stage of developement, this configuration is effective enough to cover most of the needs, and the simple configuration make it ideal. In any case I would be glad to hear from you some scenario that can take advantage of this functionality.

Thank you for nice code!

Thanks again for reviewing.

artsakenos’s picture

Assigned: artsakenos » Unassigned
Issue tags: +PAreview: review bonus
klausi’s picture

Issue tags: -PAreview: review bonus

Removing review bonus tag, you have not listed any reviews in the issue summary? Make sure to read the docs again: http://drupal.org/node/1975228

artsakenos’s picture

Hi klausi. Obviously there are no reviews in my summary. I flagged for mistake while browsing issue tags and editing the document.
Thanks for the new feedback and the correction and sorry for the inconvenience caused.

ram4nd’s picture

Status: Needs review » Needs work
  • You can't have execution rights for your files.
  • Remove .gitignore file.
  • Use small letters for br in hook_help for consistency.
  • I wouldn't put all those spaces in t function in those long form descriptions.
  • Package in .info file has a weird name.
  • You use randomly double and single quotes. I would like to see consistency.

Some of these are my personal suggestion that you don't have to take seriously. The first two are those that must be fixed.

artsakenos’s picture

Status: Needs work » Needs review

Hi ram4nd,
thank you for your feedback.

You can't have execution rights for your files.

☑ Fixed. Set permission to 644.

Remove .gitignore file.

☑ Fixed. .gitignore removed from repo.

Use small letters for br in hook_help for consistency.

☑ Fixed. Since W3C consortium is suggesting the use of lowercase ag, so I am changing it everywhere in the module.

I wouldn't put all those spaces in t function in those long form descriptions.

☑ Fixed. That’s a remnant from the previous tab indent settings. I fixed it to the 2 spaces indentations.

Package in .info file has a weird name.

☑ Fixed. I am considering to list the module in the “Fields” package since it adds a field capability, but I’ll wait for more feedback on this. Now I’ll leave it in the “Others” package.

You use randomly double and single quotes. I would like to see consistency.

☑ Fixed. I agree, thanks for noticing. I removed all non necessary double quotes.

Some of these are my personal suggestion that you don't have to take seriously. The first two are those that must be fixed.

Each one of these suggestions was precious.
Thanks a lot.

I tested the module again before pushing, thus back in the queue for this contribution to be reviewed and approved.
In the meanwhile my best wishes for a great 2014 to all the Drupal Community.

markaspot’s picture

Status: Needs review » Reviewed & tested by the community

Hi artsakenos, I can confirm that all of the issues above are fixed.

There are just two smaller issues:

files[] without classes or interfaces
files[] = osm_route.admin.inc
files[] = osm_route.install
files[] = osm_route.module

Those lines should be removed. It's only necessary to declare files[] if they declare a class or interface.

Please 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.

API Request
Your module uses Curl for requests against the API in osm_route_admin.inc. Better practice could be to use drupal_http_request instead. This Drupal HTTP client implementation takes care if a site is behind a proxy.
artsakenos’s picture

Dear markaspot, first of all thanks for taking action on the module.
I performed the fixes you suggested:
You’re right, I relayed on coder requirements without noticing the issue you cited.
About the web content retrieval, I switched to drupal_http_request leaving a wrapping method for future handling of connection/retrieval failure related behaviours. The .install is no more required, thus it has been removed.
Cheers.

artsakenos’s picture

Issue summary: View changes

I improved the module adding Driving Instructions feature: now the module can automatically store driving instructions to a multivalue long-text field of the node if needed, dividing it into segments of a roadbook. The module can also provide the same functionality on fly in form of a block for a node page.

On the other hand, after the RTBC I prefer to wait for the final review process steps before pushing major changes.

I found no references about the fact that the review bonus is mandatory [see 1, 2, 3], but I also saw this comment by an experienced reviewer. While I am getting the time that providing more valuable reviews deserves, I also developed a module for elevation profiling that seems to be sought after the Drupal community. Clearly I can’t publish it, but in case you're here cause you’re interested at handling with routing, have a look to that other contribution.

artsakenos’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus

In addition to the cited case studies, the evolution of the module OSM Route, allowing to retrieve the driving directions of a given path. will be used in the Sardegna Sentieri web site with another module I developed to contribute to the Drupal community.

mpdonadio’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +PAreview: security

pareview.sh came up clean, but I have been having problems with it the last day or two.

The project page could use some more info about how to use the module.

You need to elaborate the README.txt a little bit to better explain how to use this. At first glance I was expecting
POI and itinerary content types to already be there.

The docblock on osm_route_help is wrong.

(*) Your usage of osm_route.admin.inc is wrong. Typically, you just use this for your admin pages, and not
general hooks. You also set this via the hook_menu, and don't require it at the top level.

(*) You need a hook_uninstall in osm_route.install to get rid of the variables you are creating.

Avoid HTML in t().

Your settings form can probably use element level validation, eg element_validate_number() and friends.

(*) The hook_install() should go in osm_route.install

(*) I am pretty sure #multiple_toggle is coming from a non-core module. It isn't documented in the Form API (https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h...). I would
convert these to selects or checkboxes.

I don't think osm_route_get_webpage() is needed; use drupal_http_request() instead.

osm_route_node_presave() should use the Field API instead of directly accessing the field values. Or, you
can investigate entity_metadata_wrapper, which is part of the Entity module.

(*) The URL builder in osm_route_get_geofield() is bad. Use drupal_http_request() instead. Don't forget to error
check the response code.

Your define()s aren't namespaced to your module. These may interfere with other modules.

Normally, variables use underscores instead of camel case.

(*) You should check if the referenced nodes in osm_route_node_presave() is published or not. This
would allow users to have tentative changes to routes, and unpublished nodes are normally inaccessible to
anonymous users. See also next, which is similar.

(*) You may also have a weird situation where an itinerary may contain POIs that aren't accessible to all users (for
example, if node access records are in use). This is a tricky situation; your route may expose information about
the node the current user doesn't have access to. I am not sure what the best option is for
this. Perhaps you need to do something like

$anonymous = user_load(0);
$can_view = node_access('view', $node_point, $anonymous);

This doesn't cover the situation of hiding nodes in a route from certain users.

Starred issues (*) are blockers, but I am open to discussion about how to handle the last one.

Please don't remove the security tag, we keep that for statistics and to show examples of security problems.

artsakenos’s picture

Status: Needs work » Needs review

Dear Matthew,

pareview.sh came up clean, but I have been having problems with it the last day or two.

◎ Ok. I double checked, the offline version was reporting no issues. I checked and fixed everything with the online one.

The project page could use some more info about how to use the module.

☑ Fixed. The project page has been updated to better explain the module purpose, and to accompany the user during the installation process.

You need to elaborate the README.txt a little bit to better explain how to use this. At first glance I was expecting POI and itinerary content types to already be there.

☑ This also has been better explained, step by step with field names as an example.

> The docblock on osm_route_help is wrong.

☑ Fixed, now it just “Implements hook_help().”

(*) Your usage of osm_route.admin.inc is wrong. Typically, you just use this for your admin pages, and not general hooks. You also set this via the hook_menu, and don't require it at the top level.

☑ All the hooks not belonging to the admin panel have been moved.

(*) You need a hook_uninstall in osm_route.install to get rid of the variables you are creating.

☑ Fixed. osm_route.install has been created. hook_install moved inside, and hook_uninstall implemented.

Avoid HTML in t().

☑ Fixed

Your settings form can probably use element level validation, eg element_validate_number() and friends.

☑ Fixed, and this approach made the code cleaner.

(*) The hook_install() should go in osm_route.install

☑ Fixed

(*) I am pretty sure #multiple_toggle is coming from a non-core module. It isn't documented in the Form API (https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h...). I would convert these to selects or checkboxes.

☑ Fixed

osm_route_node_presave() should use the Field API instead of directly accessing the field values. Or, you can investigate entity_metadata_wrapper, which is part of the Entity module.

☒ In progress. Thank you for suggesting this. However, since this is not blocking and requires some cautious code replacing and testing I am taking more time to do it. I’ll handle this using entity_metadata_wrapper instead of field_get_items.

I don't think osm_route_get_webpage() is needed; use drupal_http_request() instead.

☑ Fixed. As I said in a previous comment I would have used osm_route_get_webpage has a wrapper in the future, but ok, it has been removed in favor of drupal_http_request.

(*) The URL builder in osm_route_get_geofield() is bad. Use drupal_http_request() instead. Don't forget to error check the response code.

☑ Fixed. Contingent error is caught and drupal message and watchdogs are reported.

Your define()s aren't namespaced to your module. These may interfere with other modules.

☑ Fixed

Normally, variables use underscores instead of camel case.

☑ Fixed

(*) You should check if the referenced nodes in osm_route_node_presave() is published or not. This would allow users to have tentative changes to routes, and unpublished nodes are normally inaccessible to anonymous users. See also next, which is similar.

☑ Fixed, Since unpublished nodes are (unless otherwise explicitely declared) invisbile to anonymous users, I solve this one inside the next topic.

(*) You may also have a weird situation where an itinerary may contain POIs that aren't accessible to all users (for example, if node access records are in use). This is a tricky situation; your route may expose information about the node the current user doesn't have access to. I am not sure what the best option is for this. Perhaps you need to do something like

$anonymous = user_load(0);
$can_view = node_access('view', $node_point, $anonymous);

This doesn't cover the situation of hiding nodes in a route from certain users.

☑ Fixed, Thinking about this for a while, also to the cases in which a complex system of permissions is being used, I found a solution which could be optimal.
Taking into account that, generally, this module is not intended to work inside intranets with specific permission architectures or to target this kind of situation, I prevent the exposure of non published or non accessible data to the first level of unauthorized users (anonymous users) as a default behaviour, and I let the developer who uses this module to handle more complex behaviour. At first, I was thinking to implement a hook invocation, then I found a better solution passing the list of accessible nodes by the drupal_alter. Waiting for further comments to this intriguing topic.

Starred issues (*) are blockers, but I am open to discussion about how to handle the last one.
Please don't remove the security tag, we keep that for statistics and to show examples of security problems.

◎ Ok.

Sorry for my late answer due to work commitments, and thanks for your precious comments and teachings.

klausi’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus

Review of the 7.x-1.x branch:

  • DrupalPractice has found some issues with your code, but could be false positives.
    FILE: /home/klausi/pareview_temp/osm_route.module
    --------------------------------------------------------------------------------
    FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     381 | WARNING | Unused variable $new_routes.
    --------------------------------------------------------------------------------
    

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. "$anonymous = user_load(0);": use drupal_anonymous_user() instead.
  2. "drupal_alter('osm_route_poi_nodes', $poi_nodes_id);": Hooks that are provided by a module should be documented in MODULENAME.api.php, see http://drupal.org/node/161085#api_php
  3. "$cont_title . ' ' . t('for segment') . ' ' . $i": do not concatenate variables to translatable strings, use placeholders with t() instead. Same for "t("Travel Time") . ":$cont_traveltime " . t("minutes")", this should be one string in t() using placeholders. Also elsewhere.
  4. osm_route_render(): this should be a proper theme function, so that themers can easily override the markup. Please use hook_theme() and register your theme function.
  5. osm_route_get_node_directions(): this is vulnerable to XSS exploits. You are directly printing $i_description into HTML, which stems from an untrusted third party source and must therefore be considered untrusted user input. Am I right that you are directly getting this information from the web service and storing it as is (which is correct)? You need to sanitize user provided text before printing, make sure to read https://www.drupal.org/node/28984 again.

Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

artsakenos’s picture

Issue summary: View changes
Status: Needs work » Needs review

Hello Klausi,

"$anonymous = user_load(0);": use drupal_anonymous_user() instead.

☑ Fixed

"drupal_alter('osm_route_poi_nodes', $poi_nodes_id);": Hooks that are provided by a module should be documented in MODULENAME.api.php, see http://drupal.org/node/161085#api_php

☑ Fixed

"$cont_title . ' ' . t('for segment') . ' ' . $i": do not concatenate variables to translatable strings, use placeholders with t() instead. Same for "t("Travel Time") . ":$cont_traveltime " . t("minutes")", this should be one string in t() using placeholders. Also elsewhere.

☑ Fixed

osm_route_render(): this should be a proper theme function, so that themers can easily override the markup. Please use hook_theme() and register your theme function.

☑ Fixed

osm_route_get_node_directions(): this is vulnerable to XSS exploits. You are directly printing $i_description into HTML, which stems from an untrusted third party source and must therefore be considered untrusted user input. Am I right that you are directly getting this information from the web service and storing it as is (which is correct)? You need to sanitize user provided text before printing, make sure to read https://www.drupal.org/node/28984 again.

☑ Fixed

Performed further edits according to suggestions by Denisev.

Thanks a lot.
It is going to be a great module.
A.

artsakenos’s picture

Priority: Normal » Critical
Issue summary: View changes

All request have been processed and resolved.
Changing priority to Critical as suggested in the review process.
Went first time in RTBC on 26 January, then more features have been added to provide driving instructions in the natural evolution of the module since its birth in November 2013.

mpdonadio’s picture

@artsakenos, Getting another review bonus will help speed up the process and make sure it gets on the review admins radar.

Grimreaper’s picture

Status: Needs review » Needs work

Hello,

I just test your module, it looks great. It's my first review of a project application.

Pareview.sh : OK

I look the code and I did not see something to say. Maybe phpdoc for the constant you define ?

Documentation :
I think there is one or two more steps to detail and it will be ok.

What about the cardinality of field_path ?

I tried to display some contents on a map modifying the feature in example in the openlayers module and I did not managed to do it.

Should I use the field_path on the openlayer view or the geofield in the POI content type ?

It is a little bit confusing, field_poi or field_waypoints ? : In the README.txt
"A content type (e.g., POI) containing a field of type geofield (e.g., field_poi)" ......"Create/configure the POI content type/entity (e.g., POI): Create a field of type geofield (e.g., field_waypoints)"

I also should say that I tried quickly. I will retry to test tomorrow.

Thanks for this promising module.

Grimreaper’s picture

FileSize
388.04 KB

Ok,

I took the time to well configure the content types and it worked perfectly. I attached a screenshot.

I think what need to be precised is that field_path must be multivalue (or it is unnecessary ?) and that in the openlayers views, for the geofields, uncheck "Display all values in the same row" in the "Multiple field settings" fieldset.

I think to be able to show the waypoints and the itinerary on the same map, it should be the same geofield. But that is clearly a detail.

Thanks for this really cool module.

artsakenos’s picture

Priority: Critical » Normal
Status: Needs work » Needs review

Grimreaper, thanks for your appreciation and comments.
POI is a content type, field_waypoints is a field, and you're right about the typo in the document, I fixed and improved it also in the project page according to your suggestions.

For future reviewers, please don't put module in "needs work" status if issues are not blocking, this module is already having a hard time.
Answering to #21, I am aware that further reviews are mandatory to have a project published (see my comment #14). I am working on it.

Thanks for your help and suggestions.

er.pushpinderrana’s picture

@artsakenos, just a quick review of your module.

  1. osm_route_admin_settings(): You are using multiple t() function within same field value, this should be one string in t() using placeholders. ex: #description in osm_route_near_threshold field element. Same applies for osm_route_help.
  2. In osm_route_menu(), 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. A separate permission would be good, too.
  3. At line number 112 and 389, you are using count within loop, best approach is hold count value in separate variable and use that variable in loop. This is just a general practice not related to Drupal :-)
  4. Also I tried to run your module on my local machine, getting following notices:
     Notice: Undefined property: stdClass::$field_test in osm_route_node_presave() (line 84 of C:\xampp\htdocs\drupal731\sites\all\modules\2122323\osm_route.module).
        Warning: Invalid argument supplied for foreach() in osm_route_osm_route_poi_nodes_alter() (line 56 of C:\xampp\htdocs\drupal731\sites\all\modules\2122323\osm_route.module).
        Notice: Undefined property: stdClass::$field_test in osm_route_get_node_directions() (line 371 of C:\xampp\htdocs\drupal731\sites\all\modules\2122323\osm_route.module).
        Warning: Invalid argument supplied for foreach() in osm_route_osm_route_poi_nodes_alter() (line 56 of C:\xampp\htdocs\drupal731\sites\all\modules\2122323\osm_route.module).

I will do detailed review in next few days, it would better to get review bonus back soon :)

Thank you for your hard work and patience.

artsakenos’s picture

Dear er.pushpinderrana,
Ok, I am waiting for the second step of this review then.
Please check the version of the module you downloaded, I couldn't find any $field_test in the head of the branch and I can't rise those warnings.
Thanks for your help.

artsakenos’s picture

Priority: Normal » Critical

All issues have been resolved.

balagan’s picture

Assigned: Unassigned » balagan
balagan’s picture

The name of this project is OSM Routes, but it shows up between modules as OpenStreetMap Route. I got a bit confused when I searched for OSM, and did not find the module.

Unfortunately I got "The API page http://www.yournavigation.org/api/1.0/gosmore.php could not be reached." error, and due to this the module is not working. I will try it later, and do a manual review for now.

The codig standards say "Functions and variables should be named using lowercase, and words should be separated with an underscore." I saw you missed this a few times, for example: osm_route_triesnumber, $allfields, OSM_ROUTE_YOURNAVIGATION_URL, OSM_ROUTE_YOURNAVIGATION_QUERY_TEMPLATE,

Otherwise I see no problem. I wonder if yournavigation.org is down only temporarily.

balagan’s picture

Assigned: balagan » Unassigned
Status: Needs review » Needs work
artsakenos’s picture

Priority: Critical » Normal
Status: Needs work » Needs review

Hello Balagan,
I applied fixes by your suggestions.

About OSM_ROUTE_YOURNAVIGATION_URL, OSM_ROUTE_YOURNAVIGATION_QUERY_TEMPLATE, are registered as constants, so I kept them uppercased and yournavigation refers to the server url so i prefer not to separate words.

Please note that the infrastracture hosting OSM has been renewed leading to some OOS for DNS propagation, just the day you were trying the module. Anyway, OSM Route administration panel allows you to redefine the service address, useful in case a service address changes, and also in case you want to install your Gosmore RE instance.

#24. I forgot last time, Happy Birthday OSM Route.

davidam’s picture

Automated Review

Yes. http://pareview.sh/pareview/httpgitdrupalorgsandboxartsakenos2122323git

Manual Review

Individual user account

Yes. You can read https://www.drupal.org/node/272587

No duplication

Why do you think that is better create a new project than improve routeplanner?

Master Branch

Yes, you can check: https://www.drupal.org/node/1127732

Licensing

Yes, you can check: https://www.drupal.org/licensing/faq

3rd party code

It's ok, too: https://www.drupal.org/node/422996

README.txt/README.md

You can improve it with https://www.drupal.org/node/2181737

Code long/complex enough for review

Yes, you can read: https://groups.drupal.org/node/195848

Secure Code

Why are you using get_t instead of t?
you can read: https://www.drupal.org/writing-secure-code.

Style of Code

You are using
define('OSM_ROUTE_YOURNAVIGATION_URL', 'osm_route_yournavigation_url');
define('OSM_ROUTE_YOURNAVIGATION_QUERY_TEMPLATE', 'osm_route_yournavigation_quer
y_template');
You can create variables in the admin settings, better.

This code is dirty:
$base_url = variable_get(OSM_ROUTE_YOURNAVIGATION_URL, 'http://www.yournavigat
ion.org/api/1.0/gosmore.php');
$query_base = variable_get(OSM_ROUTE_YOURNAVIGATION_QUERY_TEMPLATE, '?format=g
eojson&flat=%s&flon=%s&tlat=%s&tlon=%s&v=%s&fast=1&layer=mapnik&instructions=1&l
ang=en_GB');

admin/config/services/osm_route: The select fields: Georeferenced
content field, Coordinates field, Name of the field where to save the
calculated path appears empty.

davidam’s picture

Status: Needs review » Needs work
artsakenos’s picture

Status: Needs work » Needs review

Hi davidam, thanks for your review.

> Why do you think that is better create a new project than improve routeplanner?
Because the purpose of the routeplanner module is different. It aims to provide directions to a fixed point of interest. Also, OSM Route provides multi-path directions, multi-segment descriptions. Of course the target of route planner could change in the next years, before this module will be accepted as a contribution. Please read the project description.

> Why are you using get_t instead of t?
Please read https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/get_t/7

> admin/config/services/osm_route: The select fields: Georeferenced content field, Coordinates field, Name of the field where to save the calculated path appears empty.
Yes, you need to set them during the configuration process. Please read the project home page or the README.txt.

Again, I'm aware of the bonus procedure, but good reviews deserve some time. Please next pareview bonus hunters don't put the need work flag if there are non blocking issues. Following rules, I need to remove the critical priority.

Also note that the module stood in RTBC for 4 months with no understaken actions, subsequently I heavily changed the core due to its natural evolution, but after then, all the new issues have been addressed.

Thank you for your comments.

mpdonadio’s picture

@artsakenos, this application doesn't currently have a review bonus. If you can get one, the process will go quicker.

tormi’s picture

Status: Needs review » Reviewed & tested by the community

IMHO its ready to fly.

artsakenos’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus

Thank you Tormi.

Here we are, as can be seen in the issue summary I reviewed some more modules, so I'm adding again the Review Bonus flag, exactly one year later. Hope this can add some fuel to the truck.

Thanks to everybody who contributed with reviews, private messages, and comments to my blog to make this module great!

klausi’s picture

Status: Reviewed & tested by the community » Needs work

Review of the 7.x-1.x branch (commit 6a05da0):

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    FILE: /home/klausi/pareview_temp/osm_route.module
    --------------------------------------------------------------------------------
    FOUND 7 ERRORS AFFECTING 7 LINES
    --------------------------------------------------------------------------------
      83 | ERROR | [x] Whitespace found at end of line
     137 | ERROR | [x] Whitespace found at end of line
     150 | ERROR | [x] Whitespace found at end of line
     219 | ERROR | [x] Whitespace found at end of line
     406 | ERROR | [x] Whitespace found at end of line
     413 | ERROR | [x] Whitespace found at end of line
     465 | ERROR | [x] Expected 1 newline at end of file; 2 found
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    
  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. project page: difference to the existing module https://www.drupal.org/project/routeplanner is missing.
  2. osm_route.module: why do you globally require the admin.inc file? It does not include any hook implementations so it does not have to be loaded on every single page request? osm_route_menu() is missing the "file" option to specify the admin.inc file?
  3. "// /-{ I build an array containing the lat/long coordinates.": why does the comment start with "/-{"?
  4. osm_route_osm_route_poi_nodes_alter(): instead of having multiple DB queries with multiple node_load() calls you should collect all IDs and perform a node_load_multiple() for performance reasons. Same in osm_route_node_presave().
  5. theme_render_directions(): all theme names should be prefixed with your module name to avoid name colissions with other modules.
  6. "$i_description = check_markup($values['i_description'], 'full_html');": so "i_description" is not sanitized at all, because on most sites the full_html text format will allow any Javascript tags for example? 'full_html' might not exist on every site, so either you have a configurable text format that the admin specifies or you use generic functions such as filter_xss() or filter_xss_admin() to sanitize the description. Looks like a security blocker to me.
artsakenos’s picture

Issue summary: View changes
Status: Needs work » Needs review

Dear Klausi, thank you for the many useful suggestions,
I fixed all the issues you noticed and I took advantage of them to perform some more code cleaning.

Coder Sniffer has found some issues with your code (please check the Drupal coding standards).

☑ Fixed the white spaces issue. (.#32) Now code has no white spaces error and pareview page has been refreshed.

project page: difference to the existing module https://www.drupal.org/project/routeplanner is missing.

☑ Added the information also in the Project Page.

osm_route.module: why do you globally require the admin.inc file? It does not include any hook implementations so it does not have to be loaded on every single page request? osm_route_menu() is missing the "file" option to specify the admin.inc file?

☑ Fixed according to your suggestion.

"// /-{ I build an array containing the lat/long coordinates.": why does the comment start with "/-{"?

☑ Removed from everywhere this (personal) convention that distinguishes the coming block of code from an actual state (///-}).

osm_route_osm_route_poi_nodes_alter(): instead of having multiple DB queries with multiple node_load() calls you should collect all IDs and perform a node_load_multiple() for performance reasons. Same in osm_route_node_presave().

☑ I now exploited load_multiple, which made code cleaner and helps in performance,

theme_render_directions(): all theme names should be prefixed with your module name to avoid name colissions with other modules.

☑ Completely agree. Important. Fixed.

"$i_description = check_markup($values['i_description'], 'full_html');": so "i_description" is not sanitized at all, because on most sites the full_html text format will allow any Javascript tags for example? 'full_html' might not exist on every site, so either you have a configurable text format that the admin specifies or you use generic functions such as filter_xss() or filter_xss_admin() to sanitize the description. Looks like a security blocker to me.

☑ Thanks for let me know this function. Last time I made some research and I thought that to be a good solution, but in fact it was not.

Minor fixes to the issue summary. git#ccd67e1.

Thanks.

klausi’s picture

Assigned: Unassigned » er.pushpinderrana
Status: Needs review » Reviewed & tested by the community

manual review:

  • osm_route_get_node_directions(): still use node_load() in a loop, could use node_load_multiple(). Same for the hook_osm_route_poi_nodes_alter() docs.

But otherwise looks good to me now.

Assigning to er.pushpinderrana as he might have time to take a final look at this.

er.pushpinderrana’s picture

Assigned: er.pushpinderrana » Unassigned
Status: Reviewed & tested by the community » Fixed

Automated Review

Best practice issues identified by pareview.sh / drupalcs / coder. None

Review of the 7.x-1.x branch (commit ccd67e1):

  • No automated test cases were found, did you consider writing Simpletests or PHPUnit tests? This is not a requirement but encouraged for professional software development.

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

Manual Review

Most of the points are already covered and nothing major jumped out at me when I read `git diff ccd67e1..` so...

Thanks for your contribution, Addis!

I updated your account so you can 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 stay 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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.