This module adds a lightbox like pop-up for a contact/feedback form based on webform. This is similar to the solution provided by http://www.feedbackify.com without the need to use an external service. View the README for implementation.

Project Page:
http://drupal.org/sandbox/protitude/1815672

Git Clone
git clone --recursive --branch master http://git.drupal.org/sandbox/protitude/1815672.git webform_feedback

This is a drupal 7 module.

I have also put this module together in the past: http://drupal.org/project/icon_links although it still needs some work.

CommentFileSizeAuthor
#12 ajax-loader.gif7.64 KBDanaRoseRoss
#12 feedback-tab.png555 bytesDanaRoseRoss
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fr3shw3b’s picture

Status: Needs review » Needs work

Hi there,

first of all there are quite a few issues to sort out such as indentation, whitespace and correct comment formats.

You can find them all here:

http://ventral.org/pareview/httpgitdrupalorgsandboxprotitude1815672git

Look at the top of the page as well where it tells you about removing version number, removing old CVS $Id tags and more.

I have a few other suggestions from manual review:

  • When you append the body of the form it could be better to use a render array because I know someone like me would want to go in to my theme template or a custom module and change classes and html tags. This is a lot easier when using render arrays with prefixes and suffixes.

  • Couldn't you add the css and js files in the info file? (This is just my personal preference in keeping the module file clear, not essential)

  • You want to create a version specific branch and remove the master branch.
    You'll find more instruction on that at the PAReview link.

  • Code outside of functions is best avoided and it's probably best to load the variable in a specific hook or function in which you want to use it.

  • Where you are creating and appending jquery strings couldn't you do that in a seperate function and return it to the block view alter hook like this:
    function webform_feedback_create_js() {
      $webform_addclass = "$('#block-webform-client-block-" . $webform_feedback_id . "').addClass('webform-feedback-block');";
    
      //set the position of the feedback button to the left or right side of the browser.
      $webform_position = variable_get('webform_feedback_position');
      if ($webform_position == 'right') {
        $webform_location = "$('#webform_feedback_popup .fby-screen').addClass('feedback-button-right')";
      }
      else {
       $webform_location = "$('#webform_feedback_popup .fby-screen').addClass('feedback-button-left')"; 
      }
    
      $webform_append = '$("body").append("<div id=\'webform_feedback_popup\'><div id=\'fby-screen\' class=\'fby-screen\'><div   id=\'fby-mask\' class=\'fby-mask\'></div><div id=\'fby-tab-1553\' class=\'fby-tab fby-tab-l\'><a href=\'#block-webform-client-block-' . $webform_feedback_id . '\'></a></div></div></div>");';
    
    $webform = '(function($) {$(document).ready(function() { ' . $webform_addclass . $webform_append . $webform_location . ' }); }(jQuery));', 'inline';
    
    return $webform;
    }
    

    And then in the hook you can simply have:

    $webform = webform_feedback_create_js();
    drupal_add_js($webform);
    

    Sorry about the code looking a bit poor but posting it on here it's hard to avoid text-wrapping with long lines of string appending (but don't forget about the render arrays.)

vineet.osscube’s picture

Manual Review :

1) There is no hook_uninstall() to remove your custom variables like: webform_feedback , webform_feedback_position.

2) Create a webform_feedback.install file and add hook_uninstall() in it.

protitude’s picture

freshwebpie thanks for your prompt response. I have done everything you listed except for the render arrays. I'm not really sure how to implement this into my module. Please provide me more information if you find this necessary.

osscube I added a hook_uninstall.

Thank you both for your time.

protitude’s picture

Status: Needs work » Needs review

I think this is about ready. Any other suggestions?

jhaskins’s picture

Status: Needs review » Needs work
  1. Your project page is rather sparse. Take a look at Tips for a great project page.
  2. in webform_feedback_block_view_alter, $block->bid is the numeric id of the block so you shouldn't be adding 'webform-client-block-' before the webform_feedback variable.
  3. Perhaps you should add configure = module admin path to your .info file. That's what allows for the handy "configure links" on the module list.
protitude’s picture

Status: Needs work » Needs review

Thanks for your feedback.

I was waiting to actually get the module approved before worrying too much about the project page as I assumed this process was only concerned about the module itself. I added a little more to the project page, but it seems silly to link to things like my readme or issue queue as the links change after pushing this out as a full project. I was going to provide a quick youtube vid as well.

As for the block id, it isn't a number. In the case of a site I'm working on it's webform-client-block-2642. The variable I'm storing is just the number but the full id includes 'webform-client-block-' therefore I have to put that in.

Got the line added to the info file, thanks for the tip.

I feel like this module is pretty solid overall. Let me know if there are any glaring issues.

fr3shw3b’s picture

Status: Needs review » Needs work

Hello protitude,

Firstly have you already passed the one time review application stage as icon_links is a full project?

Going on to project review:

The comment in the file doc block for the module file is wrong as it says:
Installation file for the webform_feedback module.
which it is not.

For good practice and clarity you ought to put the webform_feedback_settings form in it's own webform_feedback_form.inc or webform_feedback.admin.inc file.

Change the $a variable in the settings form function to something more self explanatory.

protitude’s picture

Status: Needs work » Needs review

Thanks fr3shw3b.

I didn't push out icon_links and this is my first code review.

I tried to clean up the comments and add a .inc file for clarity. I created a different variable name as well, although the comment above this variable says more for what is happening here than can be explained in the name of the variable. Please let me know if there's anything else in need of a fix.

Thanks,
Miles

fr3shw3b’s picture

Status: Needs review » Needs work
Issue tags: +PAreview: security

Hello,

The JS file needs to follow the code indentation standards at:
http://drupal.org/node/172169

For JavaScript you should use Drupal behaviours instead of Document ready and looking further into it than before you can pass variables through settings so you can keep all the JavaScript/JQuery in the same file. See the page below for more info:
http://drupal.org/node/756722

For the settings form, It is better to use functions found here to get webforms with blocks turned on and getting their titles than the Database Abstraction Layer directly:
http://drupalcontrib.org/api/drupal/contributions!webform!webform.api.php/7

You could use webform_node_load and go from there.

There is a PHP error which means the module cannot be used where you are forming your processed array on line 24 of the admin inc, Your best bet is to put the array pop function in a seperate function outside of the array map and then add a returned variable version of that function to the array map.

What I mean is something like this:

<?php
function webform_feedback_array_level_pop($array_level) {
  return array_pop($array_level);
}

At the bottom of the page and then like this:

array_map(webform_feedback_array_level_pop($array_level), $field_query));

In the settings form function.

There doesn't seem to be an array level variable? so that makes this function useless.

When I enter <script>alert('XSS');</script> as the title of the webform node I get a nasty little JavaScript pop up, you want to avoid this by reading or re-reading here:
http://drupal.org/writing-secure-code

The root of this is somewhere in the block output.

Also a last thing would be that there is no AJAX popup created maybe you need to document something better or am I completely missing something?

protitude’s picture

Status: Needs work » Needs review

fr3shw3b thanks for you input. I've adjusted everything that I can from your suggestions and here are my comments to each point you have made:

  • I think the JS should conform to what you outlined. Is there not a site or tool that will check a js file against the standards, like I was able to with the module files?
  • I understand what you are saying about not using the db abstraction layer, but I see no other way to accomplish what I wanted with hook_node_load without actually knowing ahead of time which webforms have the block turned on. The webform api provides nothing to figure this out.
  • I was unable to replicate the error you outlined and the function you suggested didn't really work. So I wrote a function that does work and will hopefully address the error you received even though I wasn't able to replicate it.
  • I have no idea how I'm supposed to address the XSS error you pointed out. If you turn my module off, you'll receive the same pop-up which means that it's either an issue in webform itself or drupal. Either way, this module can't address it as my module doesn't do anything to output the title.
  • I don't think I said in the readme or anywhere else that this is an ajax module, if I did please point it out so I can make an adjustment. All this module does is take a webform block (already provided by the webform module) and overlay it with a click of the feedback button created via javascript through this module. There is no need for any ajax call as this module is using something already loaded on the page and placing elsewhere. Does that make sense?

Please let me know if there's anything else I need to address in this module. Thanks for your time.

klausi’s picture

We are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)

DanaRoseRoss’s picture

Status: Needs review » Needs work
FileSize
555 bytes
7.64 KB

I'm only seeing minor things at this point.

You have two "core" declarations in your info file.

Could you add "package = Webform" to your info file? That way the "modules" page displays it alongside Webform and other related modules so I don't need to hunt for it. This is in line with the info file standards. "If your module comes with other modules or is meant to be used exclusively with other modules, enter the name of the package here"

Lastly, consider running your images through ImageOptim (Mac only) or something similar. I was able to remove 27.7% from ajax-loader.gif and 52.7% from feedback-tab.png without any noticeable reduction in quality. I know we're talking about less than 10K here, but every byte helps, especially on slow/weak mobile connections. I've attached my reduced versions in case you just want to use those.

protitude’s picture

Status: Needs work » Needs review

Thanks DaveRoss for attaching the images. I included those with the minor .info fixes. Not sure what else this module needs? I included a link to a video screencast showing a quick overview of how to use this module. Hopefully this will help anyone trying to enable it.

erez111’s picture

Status: Needs review » Needs work

Hi, Check
http://ventral.org/pareview/httpgitdrupalorgsandboxprotitude1815672git
and solve all errors/warnings.

You should mainly convert tabs into spaces at webform_feedback.js for code standards.

Except that, code is clear and can be approved.

protitude’s picture

Status: Needs work » Needs review

Got it. Let me know next steps. Thanks!

kscheirer’s picture

Assigned: Unassigned » kscheirer

Will review this today...

kscheirer’s picture

Assigned: kscheirer » Unassigned
Status: Needs review » Reviewed & tested by the community

Looks pretty straightforward, you have a typo in your README - "bock" should be "block", but otherwise RTBC from me.

protitude’s picture

Fixed typo.

rafenden’s picture

Did You consider using jQuery UI dialog for displaying popup?

protitude’s picture

Thanks for your feedback rafal.enden. I prefer to keep my dependencies down and at this point I'd like to get the module launched and not continue to iterate. Let me know the next steps.

kscheirer’s picture

Title: webform_feedback module » [D7] Webform Feedback
Status: Reviewed & tested by the community » Fixed

Well it's been over a month and the code still looks decent.

Thanks for your contribution, protitude!

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.

----
Top Shelf Modules - Enterprise modules from the community for the community.

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