This module converts any image in a map with interactive pins on it.

Other map modules have some predefined maps that are not always the one we need.
Other techniques are not fast enough to implement ( vector maps, html map coordinates... ) and other are doesn't fit graphically ( google maps ).

This module creates a content type on install (and cleanly deletes it on uninstall) and displays the map on the edit/creation form. With one click you can give coordinates to the item inside the custom map.

The module creates a block that shows each instance of the content type Simple Pin Map Item as an accordion and also a pin on the map. A nice jQuery animation will show one or other content.

Drupal Core Version: 7.x

Link to sandbox project: http://drupal.org/sandbox/sergio.drupal/1784066

Git Clone: git clone http://git.drupal.org/sandbox/sergio.drupal/1784066.git simple_pin_map

Reviews of other projects

Comments

klausi’s picture

Status: Needs review » Needs work

Welcome,

please get a review bonus first. Then try to fix issues raised by automated review tools: http://ventral.org/pareview/httpgitdrupalorgsandboxsergiodrupal1784066git

cubeinspire’s picture

Hi i did a review to this module: http://drupal.org/node/1783722

Thank you for the Ventral I will check that up and correct what it's needed.

cubeinspire’s picture

Status: Needs work » Needs review

I made all needed corrections to respect the Drupal code standards.

I have just have left 2 commented code lines at the end of the .module file because is a part I still need to work on it.

Does it pass the review now ?

cubeinspire’s picture

Issue summary: View changes

orthographic correction

webdorado’s picture

Status: Needs review » Needs work
StatusFileSize
new65.26 KB
  1. We have installed the module, added a content, uploaded the map image file, but the section "Click on the Map to place the pin" does not show the image (see the attached screenshot). There is only a small grey area.
  2. After uninstalling the module the content type "Simple Pin Map" is not deleted from the menu "Add content".
cubeinspire’s picture

Hi,

1. This problem could be from a wrong path to the file ( I check that from my side, but it used to work correctly in a fresh new install ) or a javascript problem. For that last situation, could you provide the browser version you used ? There was any kind of error on the firebug console so I have a lead to solve the problem ?

2. I checked that and it used to work. Maybe a syntax error when validating the Drupal Code Standards.

Thank you for the review, I repair that this weekend.

cubeinspire’s picture

Status: Needs work » Needs review

Hi again,

The bug 1 is solved. It was a problem with the path when the drupal installation is inside a subfolder.
The bug 2 was caused because the menu is cached so even if the module was uninstalled correctly, the menu item remained visible. I solved this by doing a clear cache after the module was uninstalled.

d2ev’s picture

it's good module and i look forward to using it.
I installed it and it works very well for my responsive theme. Fill out the to-do mentioned for administration interface for the image setup which is hardcoded now and this module should be in drupal contrib list.

cubeinspire’s picture

Done! Configuration page created using D7 configure = admin/simple_pin_map/customize on the .info file, allowing to upload a custom map file.

DmitriyMakeev’s picture

It will be very useful module. But... ;)
1. Please change module package in .info file. I think "Blocks" or "User Interface" will be much better, instead of "logicdesign.be". Or you can simply remove it from .info file, and your module will be displayed in "Other" package.
2. Don't use jQuery(document).ready. You need to change JavaScript behaviors. Use

(function ($) {
  Drupal.behaviors.initSimplePinMap = {
    attach: function (context) {
    ...
    }
  }
})(jQuery);

3. Also, you can place module settings on block configure page. See hook_block_configure()

Some minor bugs:
1. In "simplepinmap-edit.js" needs to add click event for #simplepinmap-marker. If i want to move the pin on a few pixels to the side, then it will not work. Or you can add ui-draggable library this will allow to drag the pin. Add this to form:

    '#attached' => array(
      'library' => array(
        array('system', 'ui.core'),
        array('system', 'ui.draggable'),
      ),
    );

and use $('#simplepinmap-marker').draggable({ ... });
2. On configure page i would like to be able to select or upload icons for the pin.

DmitriyMakeev’s picture

Status: Needs review » Needs work

forgot

cubeinspire’s picture

Thanks for those good remarks Dmitriy !
I'm making those changes now.

cubeinspire’s picture

Major bugs 1, 2 and 3 corrected.
Another bug found, concerning the managed file status (file was deleted after cron doh!).
Right now there are two ways to setup the map, from the configuration of the module and from the blocK, both save correctly the new map and change the status of the file to permanent.

Minor bug1: I have a better idea. I will put an invisible layer over the two images that will receive the click event. In that way the pin will not block the click on the map.

Minor bug2: Here the problem is that the pin need to have some conditions... is not like with the map image that you can upload everything... the pin is supossed to have the arrow marking the map in the exact middle of the image and the second image (the active state of the pin) should also look like the original pin image... otherwise the module will look wrong...

For that last question I consider the best idea would be to offer many pins pairs (inactive - active) from a GPL image stock.

cubeinspire’s picture

Status: Needs work » Needs review

Minor Bug 1 implemented (with the layer idea) and commited.

For the minor bug 2... I don't know what would be better. As you said there are two options:

1. Let an upload form would give more freedom but also the possibility to "break" the module, and users with low graphic knowledge will make some very awfull things on the presentation;

2. Give a choice from a package of pin pairs will be a problem for users who knows about graphics but nothing about development... in that case she/he wouldn't be able to replace the marker files from the module correctly.

What do you suggest ?

cubeinspire’s picture

Issue summary: View changes

Adding reviews I made

cubeinspire’s picture

Issue summary: View changes

adding reviews

DmitriyMakeev’s picture

I think 3 or 4 different pin pairs will be enough.

cubeinspire’s picture

Well I already made 14 pairs...

cubeinspire’s picture

Going to commit this night

cubeinspire’s picture

Last implementation finished and commited.

Now the module allow the choice between 14 different pairs of pins.

There are also instructions on the README file about how to add a new custom file adding the file to the module folder directly.

klausi’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus +PAreview: security
StatusFileSize
new3.5 KB

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

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. I image there are a lot of existing module out there that alredy do similar stuff. Please add the differences to those module to your project page, so that users can make educated decision when choosing modules.
  2. simple_pin_map_install(): wrong doc block, this is a hook and should be documented as such. See http://drupal.org/node/1354#hookimpl . Same for simple_pin_map_uninstall().
  3. simple_pin_map_install(): No need to set variables upon installation, you can use default values with variable_get() anyway.
  4. _simple_pin_map_installed_fields(): doc block is wrong, this function does not install anything by itself? See http://drupal.org/node/1354#functions on how to document functions.
  5. Does your module only work for europe? Should that be added to the project page?
  6. _simple_pin_map_get_content(): the node query does not take node access grants into account, so node access modules might have no effect. When adding a node listing to your module, be sure to use a dynamic query created by db_select() and add a tag of "node_access". This will allow modules dealing with node access to ensure only nodes to which the user has access are retrieved, through the use of hook_query_TAG_alter(). http://api.drupal.org/api/drupal/modules!node!node.module/group/node_acc...
  7. _simple_pin_map_get_content(): you could use node_load_multiple() instead of singe node_load()s.
  8. _simple_pin_map_get_content(): this is vulnerable to XSS exploits. The node title is user provided input and needs to be sanitized before printing into HTML. See http://drupal.org/node/28984 . Please also check the other variables used in this function and whether the field content has been sanitized already or not.
  9. _simple_pin_map_get_valid_markers(): do not create image markup yourself, use theme('image', ...) instead.
  10. _simple_pin_map_get_valid_markers(): $base_path exists as global variable, why do you have to access $_SERVER['DOCUMENT_ROOT']?
  11. simple_pin_map_admin_submit(): do not use the raw, unsanitized $form_state['input'], always use $form_state['values'] where possible.

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

cubeinspire’s picture

Issue summary: View changes

adding reviews

cubeinspire’s picture

Issue summary: View changes

adding review to other projects

cubeinspire’s picture

Issue summary: View changes

Add new review

cubeinspire’s picture

Status: Needs work » Needs review

Thank you for your review !

1. I changed the text from the sandbox trying to be more explicit. http://drupal.org/sandbox/sergio.drupal/1784066

2. Done
3. Done
4. Done

5. This module works with ANY image you want to upload and is not exclusive to a geographic zone. ( Europe map is the default one but you can change it on the module config or the block config pages).
There you can set an image with the map of Africa, an image with a map of the USA, an image with a map of your kitchen, an image with the photo of your Dog... well you got it.

6. Done

7. Done

8. Added check_plain() on the 4 fields, title, body, X and Y coords.

9. Done. Changed all IMG markers on the module.

10. $base_path is not the same as DOCUMENT_ROOT. In exchange is true that I can remove $_SERVER['PHP_SELF'] and put global $base_path instead. Those variable are there to ensure that the path won't be corrupt if the installation is not made on a classic root folder. ( see comment #4 ). I've added $base_path on simple_pin_map_block_save also.

11. Done

cubeinspire’s picture

Issue summary: View changes

change text

mpdonadio’s picture

Status: Needs review » Needs work

There are a whole bunch of tilde backup files under revision control. These should be deleted.

You should double check the CSS3 properties to see if you also need/want vendor prefixes to support people who may not have totally current browsers.

In you JS, you are using a closure like

(function ($) {
})(jQuery);

but you are then using jQuery everywhere instead of $.

Your JS anonymous objects, (eg simplepinmap-edit.js:5) have trailing commas after the final element. Older versions of IE don't like this.

You also need to do a pass and clean up some minor formatting in the JS.

It looks like you are creating five variables in the hook_install() but only deleting two in the hook_uninstall().

simple_pin_map.form.inc has a no-op function that should be removed.

The alt and titles being added to the image are unstranslated strings.

cubeinspire’s picture

Status: Needs work » Needs review

There are a whole bunch of tilde backup files under revision control. These should be deleted.

That's Ubuntu gedit... deleted and changed the gedit config so it doesn't do it again...

You should double check the CSS3 properties to see if you also need/want vendor prefixes to support people who may not have totally current browsers.

The only CSS3 properties are only graphic minor improvements that doesn't affect at all to the functionability or the navigation ergonomy. Box shadow on the edit item on the node edition.


In you JS, you are using a closure like

(function ($) {
})(jQuery);

but you are then using jQuery everywhere instead of $.


True and corrected.

Your JS anonymous objects, (eg simplepinmap-edit.js:5) have trailing commas after the final element. Older versions of IE don't like this.

Didn't knew that, thanks for the info and corrected.

You also need to do a pass and clean up some minor formatting in the JS.

Yes I see that, indentations are not allways right. 2 spaces. Corrected.

It looks like you are creating five variables in the hook_install() but only deleting two in the hook_uninstall().

Hmm true, I have to delete 7 variables, 5 created on install and 2 inside the .module file. Corrected.

simple_pin_map.form.inc has a no-op function that should be removed.

Wrong. This empty function need to be there, oherwise function simple_pin_map_form_simplepinitem_node_form_alter(&$form, &$form_state, $form_id) {
will not execute. Don't ask me why it happens I only know its like this...

The alt and titles being added to the image are unstranslated strings.

Well ok :-) Corrected.

klausi’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus
StatusFileSize
new1.71 KB

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

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. some functions do not use the correct "/**" style doc block, they use the inline "/*" (that is what pareview.sh complains about).
  2. simple_pin_map_hook_info_alter(): why is this hook needed? Please add a comment.
  3. simple_pin_map_form_alter(): empty function, so remove it.
  4. "'title' => 'Edition marker',": all user facing text must run through t() for translation. Please check all your strings.
  5. simple_pin_map_admin(): doc block is wrong, this is not a hook. See http://drupal.org/node/1354#forms on how to document forms.

Not hard blockers, so I guess this is RTBC. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

cubeinspire’s picture

1. I used to let some bread crumbs between my notes at school... I guess is not possible any more here :-). Corrected

2. I used this to allow my modules alter many forms at once in a separated file. Well I guess I don't need that as I just have a single form alter, so i deleted this, the separated file, the empty function and move the alter function to the module file.
You can see the original post with this idea here: http://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_form_FORM_ID_alter/7#comment-8714

3. See point 2

4. Corrected and also 2 more image attributes without t().

5. Corrected, and added the standardized documentation for forms.

This is ok also: http://ventral.org/pareview/httpgitdrupalorgsandboxsergiodrupal1784066git

cubeinspire’s picture

Issue summary: View changes

added last review to get bonus

cubeinspire’s picture

Issue summary: View changes

added a project review

cubeinspire’s picture

Issue summary: View changes

adding project review

patrickd’s picture

Status: Reviewed & tested by the community » Fixed

Hi,

it seems that you are double-check-plaining the "simple plan map item content".
I get this as text when clicking on a pin in the block:

test
<p>tetstasdasd</p>

Sometimes, when editing the node, I was not able to set the pins position by clicking.
It just didn't move. I'm using chrome, no js errors occurred. Not sure what could be wrong here.
After reloading the page it worked again, maybe an issue with adding the js asset.

in urls I personally prefer dashes rather than underscores
admin/simple-pin-map/customize

It's okay to break long conditions, but some indenting would make it easier to read this code.

if ($delta == 'board_block'
 334   && isset($edit['simple_pin_map_marker_block_config'])
 335   && is_numeric($edit['simple_pin_map_marker_block_config'])
 336   && file_exists(

You usually do not set variables on installation. It's not an error but not the way it's designed for, best practices advice to use the default value.

The only real issue I see here is that your double-check-plaining the nodes contents on the block when clicking on a pin.

Beside this, thanks for your help in the application queue!

Thanks for your contribution!

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.

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