Hello,
I am writing to submit my first module, Views Floorplan, for consideration to be promoted to a full module project.
My motivation and goals:
As a Drupal community member, my goal is to create Views plugins with an eye toward visualization of scientific data, and to create features for Services with the long-term goal of integrating various data-generating devices with Drupal. Most of my Drupal experience came from writing tools to help me do everyday tasks in a chemical lab in grad school, and I hope to contribute the tools I developed, along with future tools in development.
My dream is to make it possible to use Drupal to send instructions to equipment, which then executes the instructions and returns data back to Drupal for sharing between collaborators.
Here are the details for Views Floorplan:
General Purpose:
Views Floorplan is so name as it is intended for use for adding information to floorplan maps as "floorplan points" with jQuery popout boxes. This was provided as a Views style plugin, so that floorplan points could be filterable and fieldable.
Sandbox Project:
https://www.drupal.org/sandbox/laboratory.mike/2359995
Cloning the Repository:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/laboratory.mike/2359995.git views_floorplan
Examples of module use cases:
Views Floorplan is being used to provide how-to documentation for a client's website. Literally, we have images of each major page, with floorplan points used as "how to" links to explain to users how to edit the content, how to handle translations, etc.
Also, the module name was inspired for it's original intended use in an inventory management program, in which an inventory search returns items as points on a floorplan.
I look forward to your review and feedback, thank you.
laboratory.mike
Review Bonus Reviews
Clean Markup Views: https://www.drupal.org/node/2494887#comment-10061948
ReachEdge: https://www.drupal.org/node/2678258#comment-10977721
Comments
Comment #1
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxlaboratorymike2359995git
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.
Comment #2
PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #3
laboratory.mikeOK, I've figured out how to get the form_alter for node edit forms working, and I've made substantial admin updates along with fixes requested by pareview.
I am ready for review.
Comment #4
davidgrayston commentedThe automated review has highlighted a few problems: http://pareview.sh/pareview/httpgitdrupalorgsandboxlaboratorymike2359995git
function _array_insert($array, $position, $insert) {I can do a manual review in the meantime
Comment #5
davidgrayston commentedInitial code review:
variable_get_value()insideif ($view->style_plugin->plugin_name === 'floorplan') {, to preventvariable_get_value()being called on all viewsWill now try out the module functionality
Comment #6
laboratory.mikeThanks for the feedback. I have made updates with your recommendations, installed Coder and made changes per its recommendations, and I've tested that the module still works as expected using Drupal.behaviors .
Comment #7
vineethaw commentedHi,
The module file contains an unused variable $message at line no.181.Delete it.
The drop down values in the views_floorplan_plugin_style_floorplan.inc file are not translatable.
also in your form alter function you have not checked the form_id.If you need to alter a particular form use hook_form_id_alter instead.
Comment #8
pravin ajaaz commentedIts a nice module!
Comment #9
pravin ajaaz commentedComment #10
awasson commented@laboratory.mike, I'm intrigued with this module. It's something I can see being extremely handy in some of the projects I support so I'll be happy to help out finalizing and reviewing it, if I can.
PAREVIEW
Since your latest commits PAReview is showing quite a number of formatting errors. I think many of the formatting errors were always there but the PAReview tool has been updated and as a result it is just that much more picky about spacing and indenting in comments. It's pretty simple stuff to fix, if only a bit tedious.
PAReview is also still complaining about the $message variable that isn't being used. That'll need to be used or purged from the code unless it is being used somewhere.
SETUP ISSUES
Now getting down to business... Initially I couldn't seem to get this thing to work properly and it's because I didn't set up my content types and fields before configuring the module so I think the instructions need to be updated to reflect the need to set up the content types then configure the module. Something like the following:
Basic Module Setup (instruction)
Once the module is enabled, create two content types.
Once the content types have beed created clear all caches and then navigate to the Views Floorplan Settings page (admin/config/user-interface/views_floorplan) to configure the module to use the fields and content types that you have created.
Note: If you do not see settings for the fields that you've created in your content types, clear all caches again and visit the Views Floorplan settings page again.
Once you have set the appropriate fields in the Views Floorplan Settings page, you should be able to create a Floorplan node with an image of the Floorplan you choose and then add points to it by creating Floorplan Points nodes. When select the Floorplan via the Entity Reference Field within a Floorplan Point, the Foorplan jQuery tool will pop up allowing you to set where the point will be positioned on the Floorplan image.
VIEWS ISSUES
Now that I know how to install and set up the content types and configure the module first time, every time, I was struggling with creating the view.
The README and setup instructions don't really tell the user what type of view they are creating and they don't mention that in the view Advanced Settings we need to add a relationship or a contextual filter to make it work. I suggest adding instructions to create a view.
Basic View Setup (instruction)
Once you have a Floorplan and Floorplan Points that reference the Floorplan, you can create a view of the Floorplan Points content type that will reference the Foorplan and overlay the points above the Floorplan image.
Note: The floorplan view display format allows you to decide what color the points will be displayed with and you can either set a single colour as determined by a 'color' text field on the 'Floorplan' content type or a variety of colors that can be set via a 'color' text field on the 'Floorplan Point' content type. Whichever method you choose, you will want to create a 'color' text field on one of the content types as set it with HEX codes representing the color of choice.
A basic view will be set up with the title field exposed.
In the View editing tools, in the Advanced section add a Relationship of the type Entity Reference and choose the one that is of "A bridge to the Content entity that is referenced via the entity reference field that you are using in your Floorplan Point content type to reference the Floorplan.
Add the following fields and set them to "Exclude from display":
Note: The Floorplan image will need to be configured to "rewrite the output" so that it provides the FID and not render the image. You can do that via the Rewrite Results option and selecting the Replacement Pattern for the 'Raw fid'
Next, navigate to the FORMAT -> Floorplan -> Settings in the View editing interface and set the Image FID, X-distance Field, Y-Distance Field and the Color Field. The Image FID field will likely have a very long name due to the entity reference relationship that eventually resolves to the Floorplan Image you set up. The rest should be rpetty straight forward.
Once the Floorplan Settings have beed net, you should see the Floorplan background image and the points that you have created to overlay over it. They may not be positioned as you expect hoever, once you look at the view within the site, it should be exactly as expected.
FEATURE REQUEST
To really make this module effective, it might be a good idea to have it create a Floorplan node type and a Floorplan Point type with a basic view. That would certainly speed up usage. I don't expect it would be a deal breaker providing the instructions are concise enough but it sure would make it easy to get up and running with. I'm happy to lend a hand with this module if you need it. I think it's really quite useful and I've yet to see a duplicate.
Cheers,
Andrew
Comment #11
laboratory.mikeThanks so much for the great feedback. I'm on vacation at the moment, but have been working on the PAReview notes, removed the offending $message variable, and have also been working on a bug that causes the selection tool to not show on node/*/edit pages if the floorplan information was already set. I will commit this material when I next get a chance this week.
Comment #12
laboratory.mikeReplying to:
For this, my plan towards the end of the review process is to build a "Floorplan Example" module with Features that will contain the view, fields, and content types. This way users have the option of starting with some pre-built materials, or to start blank if they know what they are doing (which should be the case after using it a couple of times). I will create it once I address the code issues today.
Comment #13
awasson commentedHi Mike,
Good plan regarding the Floorplan Example sub module. I've been playing around with it as time permits and once you know what you're doing, it's pretty simple to work with. I particularly like the way you can colour-key different points on a Floorplan by adding a colour field to your Floorplan Point nodes and then assigning the color attribute to it in the View display.
On a side-note
I've got a project percolating on the side for one of my clients that I think I'll be using with this and I think I can do everything I need to tailor it for my needs via overriding the JS and CSS files but I have a question regarding making it mobile friendly. Since it uses pixel coordinates for placing the points, it's not likely that it'll be easy to make a mobile friendly Floorplan view. Have you any ideas about how one would present a Floorplan for the small screen?
Comment #14
laboratory.mike@awasson,
The module works by specifying percentage widths via the floorplan point fields, which jQuery uses to calculate pixel widths for node/edit pages, but otherwise leaves as percentages for Views. If you look in the provided JS, you should be able to see where the program calculates the width/height of the object, and the corresponding pixel dimensions.
If you are looking to modify the JS, I'm thinking you could recalculate everything on screen rotation, if needed. Otherwise, a screen refresh will work if you're testing resolutions from your desktop. Let me know if this isn't behaving as expected.
Also, I would certainly welcome commits to give people an optional JS file that handles mobile, and an updated CSS file. I have recently committed some updates if you would like to pull those; I'm also hoping to have the example module and everything but the @params and @see comments done today.
Comment #15
laboratory.mikeOK, I've got the floorplan example module set up and committed. It should rewrite the views_floorplan settings to automatically set up for the example module while giving a message about the same; no fussing with the settings page required ;)
@awasson, I realize I misunderstood your question earlier. For now, with node/*/edit pages you will need to override the pixel dimensions for the image with CSS and !important . For views, you can use percentage/em width and height settings, but if you need to change these for mobile, you will again need to put in a CSS override. There should be an ID attribute for every item; so selection should be straightforward in Views.
Comment #16
laboratory.mikeFor PAReview I have covered pretty much everything I can at this point. A few outstanding items that I am unsure about editing are:
1) The function case for the Views plugin class. The current case matches the case used in Views.
2) A few errors found in the Features module I created (Views Floorplan Example), since they would be generated by Features every time I generate the module. I did clean up the .install file as I wrote it.
Comment #17
awasson commented@laboratory.mike, I've been away on holidays and have to head out of town again tonight again but thought I would check in.
I'll look into the responsive ideas when I'm back. I thought about using !important in a custom stylesheet as well. I'll give it some more thought and if I come up with anything interesting, I'll let you know.
Regarding the PAReview, I've looked at the PAReview report and reviewed the changes you made. I'm not sure that anything can be done regarding the variable $translatables because if I'm not mistaken that will be used by views so you can't simply remove it but PAReview can't see where it will be used so it is throwing it up as an error.
Regarding the errors in formatting, I wonder if someone else can weigh in regarding the conflict between what Views needs in naming conventions and what PAReview demands for a clean review.
Comment #18
laboratory.mike@awasson, I've put the mobile issue into my issue queue: https://www.drupal.org/node/2514810
For now I'll consider it a feature request that's important but non-critical for release.
Comment #19
babusaheb.vikas commentedHi laboratory.mike,
Some errors reported by the automated code review tool: http://pareview.sh/pareview/httpgitdrupalorgsandboxlaboratorymike2359995git
you should add a module configure link in *.info file, so that a user can quickly reach at module configuration page from modules list.
configure = admin/config/user-interface/views_floorplanComment #20
laboratory.mikeI've done a bit more cleanup, and at this point I have 3 false positives on PA Review:
"ViewsFloorplanPluginStyleFloorplan::option_definition" is not in lowerCamel format
"ViewsFloorplanPluginStyleFloorplan::option_form" is not in lowerCamel format
-> These items are written this way due to how the Views API writes them. Otherwise I don't think they will be detected.
js/floorplan-point-tool-entity.js: line 39, col 5, Error - floorplanXY is defined but never used (no-unused-vars)
-> This is function is an event listener called in a node form.
Comment #21
kattekrab commentedWaiting for review since October 2015.
Bumping to critical as per Review process for Full Project Applications: What to Expect
This looks like it's been pretty thoroughly reviewed, with many rounds of revision, so hopefully it's actually close to RTBC now
@laboratory.mike - if you could review some other projects to pick up the PAReview bonus while we get more reviewer eyeballs on this - hopefully we can get this approved quickly for you.
Info on the review bonus project is here: https://www.drupal.org/node/1975228
Comment #22
awasson commentedI'd like to see this get pushed forward too. It's an amazing concept and module. I reviewed it over 9 months ago so I'll give it another review and hopefully we can get this one pushed through to acceptance.
Comment #23
laboratory.mikeComment #24
laboratory.mike@kattekrab, thanks for re-opening this. I added links to two reviews I have done; let me know of those qualify, and I will try to get a third one done this week.
Comment #25
extremal commentedHi laboratory.mike,
Interesting module !
Automated review showed some errors and warnings, please correct where possible.
http://pareview.sh/pareview/httpgitdrupalorgsandboxlaboratorymike2359995git
Manual review:
- worth considering moving custom markup into separate theme functions
- get rid of dpm() function (this was highlighted just as a warning in automated review, but might cause a fatal error if devel module is not enabled)
- you might want to consider using '#attached' to add the js to the element (where possible) instead of drupal_add_js
Comment #26
skaughthello!
your JS files are not properly wrapped
in your views_floorplan_node_ajax() function. it would be nicer to render your image through a theme function: theme_image().
you do need to check over your dependencies (.info) -- you are using node_load(),
Comment #27
braindrift commentedHi laboratory.mike,
you should consider to implement theme functions for generating the markup that is currentls generated in
views_floorplan_form_alter(),views_floorplan_node_ajax()and your views style plugin. This would avoid code dublication and make the code more readable and extendable.You should move the views_floorplan_plugin_style_floorplan.inc file to a views/plugins subdirectory of your module directory.
Best regards
Comment #28
braindrift commentedI think my suggestions are not application blockes.
Comment #29
klausiSorry for the delay. Make sure to review more project applications and get a review bonus and this will get finished faster.
manual review:
Comment #30
ashwinshHello laboratory.mike,
My findings for your modue as follows:
views_floorplan.module
Line 179: Use "elseif" in place of "else if"
Thank you,
Comment #31
joachim commentedInteresting module!
This should go in an inc file.
+1 for declaring these.
Though... I think a lot of these should be moved to the Views style plugin. Eg, the fields.
This is overkill. Just provide your CSS in the module. Site builders can override it in their theme if they want to.
All HTML code should be in theme templates or functions. Use theme_table() here maybe?
Stray debug.
There's a way to do that warning automatically in the hook.
You control the plugin! No need for this -- do it in the plugin code.
If you're detecting the presence of fields, there are better ways.
Also, I hope you've not hardcoded to nodes... ;)
Oh you have :( On D7 it's best to do things for generic entities, not just nodes, if at all reasonable.
Comment #32
laboratory.mikeHi all,
Thanks for all the feedback. Since there was a long lull in responses a while back (granted I need to do my third review so I can get the bonus) I had set this aside for a while. I am going to try and find time over the next couple weeks to work on all of the recommendations - and to write that third bonus review!
Comment #33
PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.